/*
 *
 * Copyright (C)  12-sept-2003 Jean-Yves Beaujean 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,  59
 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * 
 */
package jxtray.util;


import java.io.File;

/** This class contains only static members and methods.
 *  It contains all extensions used by Jxtray and a method that allow 
 *  to extract extension from a filename.
 */
public class FileUtilities 
{
		
	public static String CSV  = "csv";
	public static String GZIP = "tgz";
	public static String HTML = "html";
	public static String JAR  = "jar";
	public static String SQL  = "sql";
	public static String XLS  = "xls";
	public static String XML  = "xml";
	public static String XUL  = "xul";
	public static String ZIP  = "zip";
		
	/** Return extension from a filename */
	public static String getExtension( File f)
	{
		String extension = null;
		String fileName = f.getName();
		int index = fileName.lastIndexOf('.');
		if ( index > 0 && index < fileName.length() )
				extension = fileName.substring(index+1).toLowerCase();
					
		return extension ;
	}
}
