|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.util.MIME
public class MIME
Defines a set of enumerated type objects used to indicate MIME types. Each object has a method to return its canonical string identifier as well as a default file extension. This is neither intended to be standard nor exhaustive, nor is it internationalized since that creates unwanted dependencies for what is meant to be a simple utility class.
For more information: MIME
This class also includes a number of static utility methods used for conversion and determination of MIME types from Strings.
| Field Summary | |
|---|---|
static MIME |
DOCBOOK
Indicates the MIME type for DocBook XML, "application/docbook+xml", (file extension ".xml"). |
static MIME |
GIF
Indicates the MIME type for GIF, "image/gif", (file extension ".gif"). |
static MIME |
HTML
Indicates the MIME type for HTML, "text/html", (file extension ".html" or ".htm"). |
static MIME |
JPEG
Indicates the MIME type for JPEG, "image/jpeg", (file extension ".jpg"). |
static MIME |
JSP
Indicates the MIME type for JSP, "application/jsp", (file extension ".jsp"). |
static MIME |
JSPWIKI
Indicates the (unofficial) MIME type for Wiki text, "application/x-wiki+jspwiki", (file extension ".txt" or ".wik"). |
static MIME |
LTM
Indicates the (unofficial) MIME type for LTM text, "text/x-ltm", (file extension ".ltm"). |
static MIME |
PDF
Indicates the MIME type for PDF, "application/pdf", (file extension ".pdf"). |
static MIME |
PNG
Indicates the MIME type for PNG, "image/png", (file extension ".png"). |
static MIME |
PS
Indicates the MIME type for Postscript, "application/postscript", (file extension ".ps"). |
static MIME |
TEXT
Indicates the MIME type for plain text, "text/plain", (file extension ".txt"). |
static MIME |
UNKNOWN
Indicates an unknown MIME type. |
static MIME |
WIKI
Indicates the (unofficial) MIME type for Wiki text, "text/wiki", (file extension ".txt" or ".wik"). |
static MIME |
XHTML
Indicates the MIME type for XHTML, "application/xhtml+xml", (file extension ".xhtml", though more commonly just ".html" or ".htm"). |
static MIME |
XML
Indicates the MIME type for XML, "application/xml", (file extension ".xml"). |
static MIME |
XTM
Indicates the (proposed) MIME type for XTM, "application/xtm+xml", (file extension ".xtm"). |
| Constructor Summary | |
|---|---|
MIME(String id,
String label,
String extension)
Constructor for a MIME object provided its MIME identifier String, a displayable label, and a String containing its file extension. |
|
MIME(String id,
String label,
String[] extensions)
Constructor for a MIME object provided its MIME identifier String, a displayable label, and an array containing one or more file extensions. |
|
| Method Summary | |
|---|---|
String |
getExtension()
Returns a String containing the most common MIME type identifier corresponding to this MIME type object. |
String[] |
getExtensions()
Returns a String array containing the MIME type identifiers corresponding to this MIME type object. |
String |
getLabel()
Returns a displayable String label for this MIME type. |
static MIME |
getMIMEtype(String s)
A static method that returns the MIME type object (as according to IETF RFC 1521 and 1522) provided with the MIME type String s. |
static MIME |
getMIMETypeFromFileExtension(String ext)
A static method that returns the MIME type based on file extension String. |
static MIME |
getMIMETypeFromSystemId(String systemId)
A static method that returns a guess of the MIME type as an int (as according to IETF RFC 1521 and 1522) provided with the system identifier systemId, by checking the file extension. |
static boolean |
isTextFormat(MIME mime)
Returns true if the MIME parameter is a known text-safe format. |
static boolean |
isXMLFormat(MIME mime)
Returns true if the MIME parameter is a known XML format. |
String |
toString()
Returns a String containing the MIME type identifier corresponding to this MIME type object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final MIME TEXT
public static final MIME JSPWIKI
public static final MIME WIKI
public static final MIME LTM
public static final MIME HTML
public static final MIME XML
public static final MIME DOCBOOK
public static final MIME XHTML
public static final MIME XTM
public static final MIME PDF
public static final MIME JSP
public static final MIME PS
public static final MIME GIF
public static final MIME PNG
public static final MIME JPEG
public static final MIME UNKNOWN
| Constructor Detail |
|---|
public MIME(String id,
String label,
String extension)
public MIME(String id,
String label,
String[] extensions)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic String getLabel()
public String getExtension()
public String[] getExtensions()
public static boolean isTextFormat(MIME mime)
public static boolean isXMLFormat(MIME mime)
public static MIME getMIMEtype(String s)
public static MIME getMIMETypeFromSystemId(String systemId)
The list of identified MIME types are defined in this class:
file extension(s) returns:
"*.txt" "*.text" MIME.TEXT
"*.xml" MIME.XML
"*.html" "*.htm" MIME.HTML
"*.ltm" MIME.LTM
"*.xtm" MIME.XTM
"*.pdf" MIME.PDF
"*.jsp" MIME.JSP
"*.ps" MIME.PS
"*.gif" MIME.GIF
"*.jpg" "*.jpeg" MIME.JPEG
otherwise... MIME.UNKNOWN
NOTE: returns MIME.UNKNOWN if the system identifier has more than one hash ("#").
public static MIME getMIMETypeFromFileExtension(String ext)
getMIMETypeFromSystemId(String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||