public class MimeTypeFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
fname |
private java.util.Hashtable |
type_hash |
Constructor and Description |
---|
MimeTypeFile()
Creates an empty DB.
|
MimeTypeFile(java.io.InputStream is) |
MimeTypeFile(java.lang.String new_fname)
The construtor that takes a filename as an argument.
|
Modifier and Type | Method and Description |
---|---|
void |
appendToRegistry(java.lang.String mime_types)
Appends string of entries to the types registry, must be valid
.mime.types format.
|
MimeTypeEntry |
getMimeTypeEntry(java.lang.String file_ext)
get the MimeTypeEntry based on the file extension
|
java.lang.String |
getMIMETypeString(java.lang.String file_ext)
Get the MIME type string corresponding to the file extension.
|
private void |
parse(java.io.BufferedReader buf_reader)
Parse a stream of mime.types entries.
|
private void |
parseEntry(java.lang.String line)
Parse single mime.types entry.
|
public MimeTypeFile(java.lang.String new_fname) throws java.io.IOException
new_fname
- The file name of the mime types file.java.io.IOException
- for I/O errorspublic MimeTypeFile(java.io.InputStream is) throws java.io.IOException
java.io.IOException
public MimeTypeFile()
public MimeTypeEntry getMimeTypeEntry(java.lang.String file_ext)
file_ext
- the file extensionpublic java.lang.String getMIMETypeString(java.lang.String file_ext)
file_ext
- the file extensionpublic void appendToRegistry(java.lang.String mime_types)
mime_types
- the mime.types stringprivate void parse(java.io.BufferedReader buf_reader) throws java.io.IOException
java.io.IOException
private void parseEntry(java.lang.String line)