public class FileType
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileType.BUILDIN
The names of the build in file types.
|
Modifier and Type | Field and Description |
---|---|
static FileType |
ARCHIVE
Binary file type for archives such as zip and tar.gz.
|
static FileType |
BINARY
Ancestor of all binary file types.
|
static FileType |
DOCUMENT
File type for binary documents such as PDF, odf and docx.
|
static FileType |
FILE
The supertype of all file types.
|
protected static java.util.Map<java.lang.String,FileType> |
fileTypes
To be accessed by inheriting classes only.
|
static FileType |
SGML
SGML file types such as html.
|
static FileType |
SOURCE
Source code text files.
|
static FileType |
TABLE
Tabular text data such as tab and csv.
|
static FileType |
TEXT
Ancestor of all text file types.
|
static boolean |
TREAT_UNKNOWN_AS_BINARY
Should files of unknown mime type be treated as binary (or as plain text)?
|
static FileType |
XML
XML base type.
|
Constructor and Description |
---|
FileType(java.lang.String name,
FileType parent)
Every file type has a name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Two file types are considered equal if they have the same name.
|
java.nio.charset.Charset |
getCharacterset()
Returns the associated character set.
|
java.lang.String |
getName()
Returns the file type name.
|
FileType |
getParentType()
Returns the parent type.
|
static FileType |
getType(java.lang.String name)
Returns the specified type by name if it does exist.
|
int |
hashCode()
Hashcode for this FileType.
|
boolean |
isBinary()
Returns true if this Mime type denotes a binary file.
|
boolean |
isCharsetDefined()
Returns true if the character set associate with this file type is
specifically defined for this file type.
|
boolean |
isText()
Returns true if this Mime type denotes a text file.
|
void |
setCharacterset(java.nio.charset.Charset charset)
Defines the character set for this file type or removes
the definition (if the parameter is null).
|
void |
setParentType(FileType newParent)
Sets the specified FileType as new parent type of this type.
|
java.lang.String |
toString()
Returns "FileType:<Typ>".
|
public static boolean TREAT_UNKNOWN_AS_BINARY
protected static java.util.Map<java.lang.String,FileType> fileTypes
public static final FileType FILE
public static final FileType BINARY
public static final FileType ARCHIVE
public static final FileType DOCUMENT
public static final FileType TEXT
public static final FileType TABLE
public static final FileType SOURCE
public static final FileType SGML
public static final FileType XML
public FileType(java.lang.String name, FileType parent)
name
- file type nameparent
- file type parentpublic static FileType getType(java.lang.String name)
name
- file type name to look uppublic java.lang.String getName()
public FileType getParentType()
public void setParentType(FileType newParent)
newParent
- to be set, must not be nulljava.lang.NullPointerException
- if specified parent is nulljava.lang.IllegalArgumentException
- if specified parent is a descendant of this FileTypepublic java.nio.charset.Charset getCharacterset()
public void setCharacterset(java.nio.charset.Charset charset)
charset
- to be associated with this file type or null.public boolean isCharsetDefined()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isBinary()
public boolean isText()