|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.net.MimeTypes
public final class MimeTypes
Used to keep track of a large set of MimeType
objects (offering a mechanism to guess mime type from file
extension).
class Example {
public void main(String[] args) {
com.ccg.net.MimeTypes o = new com.ccg.net.MimeTypes();
System.out.println(o);
}
}
| Constructor Summary | |
|---|---|
MimeTypes()
Initializes object to... |
|
MimeTypes(MimeType[] init)
Create and initialize your own mime type object. |
|
| Method Summary | |
|---|---|
void |
add(MimeType mt)
One line summary... |
String |
getContentTypeFor(String ext)
Looks up the content type identifier for a particular file extension. |
MimeType |
getMimeType(String mt)
Validates a MIME type string by looking up MIME type object. |
MimeType |
getMimeTypeForExt(String ext)
Looks up the content type identifier for a particular file extension. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MimeTypes()
public MimeTypes(MimeType[] init)
This constructor allows one to create either a empty MimeTypes
object, or to initialize it with their own specific set of MimeType objects.
mta - Array of mime type objects to initialize with (or pass null if
you want it to initially be empty).| Method Detail |
|---|
public String getContentTypeFor(String ext)
This method looks up the content type for a particular file extension. For example, if you pass "html" you would get back "text/html".
getContentTypeFor in interface FileNameMapext - File extension to look up content type identifier for.
getMimeTypeForExt(java.lang.String)public MimeType getMimeTypeForExt(String ext)
This method looks up the content type for a particular file extension. For example, if you pass "html" you would get back "text/html".
ext - File extension to look up content type identifier for.
getMimeTypeForExt(java.lang.String)public void add(MimeType mt)
arg1 - arg1-describearg2 - arg2-describe
exc - Why thrownpublic MimeType getMimeType(String mt)
This method is handy to use to validate a MIME type string (to
make sure it is one of the MIME types recognized by this
table). You pass in a MIME type string (like "text/html") and get
back the corresponding MimeType object - or
MimeType.UNKNOWN if your string isn't recognized.
WARNING: This is case sensitive (until I determine that MIME types are not case sensative)!
mt - The MIME type (as a string) you want to get the MimeType
object for (for example: "text/plain"). You may pass null.
MimeType object we have registered to
handle the request, or MimeType.UNKNOWN if we don't
recognize your string. Never returns null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||