|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.io.ContentType
A type-safe enumeration of content types handled by the system.
Field Summary | |
static ContentType |
HTML
Type used for HTML markup (both classical HTML and XHTML). |
static String |
KEY_MIME_TYPE
Context key recommended to store the MIME type string. |
static String |
MIME_HTML
MIME type for HTML. |
static String |
MIME_PLAIN
MIME type for plain text. |
static ContentType |
MS_WORD
Type used for MS Word documents. |
static ContentType |
PDF
Type used for PDF documents (Adobe Acrobat). |
static ContentType |
PLAIN_TEXT
Type used for plain text content (without any markup). |
static ContentType |
RTF
Type used for rich text format. |
static ContentType |
UNKNOWN
Type used for any other content or content whose type cannot be determined. |
static ContentType |
URI_LIST
Type used for lists of URIs or URLs, as defined in RFC 2483. |
static ContentType |
XML
Type used for XML markup. |
Method Summary | |
static ContentType |
determineContentType(String mimeType,
File file)
Determines the content type based an MIME type and/or file name. |
static ContentType |
determineContentType(String mimeType,
URL url)
Determines the content type based an MIME type and/or URL. |
boolean |
extensionMatches(String extension)
Whether a specified file name extension is contained in the set of file name extensions typical for this content type. |
String |
getDefaultMimeType()
Returns the most common MIME type used for documents of this type |
String |
getName()
Returns the identifier of this content type. |
static void |
main(String[] args)
Some test cases. |
boolean |
mimeTokenMatches(String token)
Whether a specified MIME type token is contained in the set of MIME type tokens typical for this content type. |
String |
toString()
Returns a String representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String KEY_MIME_TYPE
public static final String MIME_HTML
public static final String MIME_PLAIN
public static final ContentType HTML
public static final ContentType MS_WORD
public static final ContentType PDF
public static final ContentType PLAIN_TEXT
public static final ContentType RTF
public static final ContentType URI_LIST
public static final ContentType XML
HTML
is used instead (this works as this type is
defined after the HTML
type -- the first match is used).
public static final ContentType UNKNOWN
Method Detail |
public static ContentType determineContentType(String mimeType, File file)
UNKNOWN
is returned.
mimeType
- the MIME type (might be null
);
the full list of MIME types is available at
www.iana.org/assignments/media-typesfile
- the file name (might be null
)
UNKNOWN
if no
identification was possiblepublic static ContentType determineContentType(String mimeType, URL url)
UNKNOWN
is returned.
mimeType
- the MIME type (might be null
);
the full list of MIME types is available at
www.iana.org/assignments/media-typesurl
- the URL (might be null
)
UNKNOWN
if no
identification was possiblepublic static void main(String[] args)
args
- the command-line parameters (ignored)public boolean extensionMatches(String extension)
extension
- the file name extension to inspect
true
iff the extension is typical for this content
typepublic String getDefaultMimeType()
public String getName()
public boolean mimeTokenMatches(String token)
token
- the MIME type token to inspect
true
iff the token is typical for this content typepublic String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |