|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<FileType>
net.sf.sfac.file.FileType
public enum FileType
All knows file types descriptors/filters. Those FileType are mostly language independent, only the filter for the
JFileChooser (inner class FileChooserFilter) contains a language-dependent description.
| Method Summary | |
|---|---|
boolean |
accept(File f)
Return true if the given file has the good extension or if the given file is a directory. |
boolean |
accept(File dir,
String name)
Return true if the given file name has the good extension. |
String[] |
getAcceptedExtensions()
|
String |
getDefaultDescription()
|
String |
getDefaultExtension()
|
static String |
getFileExtension(String fileName)
Utility method to get the extension of a file name (without the dot). |
static FileType |
getFileType(File fil,
FileType[] possibleTypes,
FileType defaultType)
Get the type of the given file. |
boolean |
isAcceptedExtension(String extension)
|
boolean |
isFileOfType(File fil)
Check if the given file is of the specifed type. |
static File |
setFileExtension(File fil,
FileType type,
boolean overrideExisting)
Add the correct extension to the given file. |
String |
toString()
|
static FileType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static FileType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final FileType FILE_TYPE_ALL
public static final FileType FILE_TYPE_TEXT
public static final FileType FILE_TYPE_XML
public static final FileType FILE_TYPE_PROPERTIES
public static final FileType FILE_TYPE_PNG
public static final FileType FILE_TYPE_JPEG
public static final FileType FILE_TYPE_GIF
public static final FileType FILE_TYPE_IMAGES
public static final FileType FILE_TYPE_PDF
public static final FileType FILE_TYPE_ZIP
public static final FileType FILE_TYPE_CBZ
public static final FileType FILE_TYPE_HTML
public static final FileType FILE_TYPE_DB
public static final FileType FILE_TYPE_CSV
public static final FileType FILE_TYPE_FO
public static final FileType FILE_TYPE_SONG
public static final FileType FILE_TYPE_MP3
public static final FileType FILE_TYPE_VIDEO
| Method Detail |
|---|
public static FileType[] values()
for (FileType c : FileType.values()) System.out.println(c);
public static FileType valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is null
public static FileType getFileType(File fil,
FileType[] possibleTypes,
FileType defaultType)
fil - the file of which we want to know the type.possibleTypes - all the possible types.defaultType - the type returned if none of the given types matched.
public static File setFileExtension(File fil,
FileType type,
boolean overrideExisting)
fil - The file to be updated with correct extension.type - The type of the file (defining the extension it should have)overrideExisting - if true any existing extension not matching the expected one will be replaced. If false, the correct extension is
only added if there is no extension currently defined.
public static String getFileExtension(String fileName)
fileName - The full file name (like: "myFile.txt").
public String getDefaultDescription()
public String getDefaultExtension()
public String[] getAcceptedExtensions()
public boolean accept(File f)
accept in interface FileFilter
public boolean accept(File dir,
String name)
accept in interface FilenameFilterpublic boolean isFileOfType(File fil)
public boolean isAcceptedExtension(String extension)
public String toString()
toString in class Enum<FileType>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||