Package ch.autumo.commons.mime
Class MimeTypeFile
java.lang.Object
ch.autumo.commons.mime.MimeTypeFile
- All Implemented Interfaces:
jakarta.activation.MimeTypeRegistry
Mime type file.
Patched: autumo GmbH, Michael Gasche
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty mime types registry.Construct with mime types input stream ( from"mime.types" usually).MimeTypeFile
(String mimeTypesfile) Construct with mime types file ("mime.types" usually). -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendToRegistry
(String mime_types) Appends string of entries to the types registry, must be valid mime.types format.jakarta.activation.MimeTypeEntry
getMimeTypeEntry
(String ext) Get a mime type entry based on the file extension.getMIMETypeString
(String ext) Get a mime type entry based on the file extension.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger.
-
-
Constructor Details
-
MimeTypeFile
Construct with mime types file ("mime.types" usually).- Parameters:
mimeTypesfile
- The file name of the mime types file.- Throws:
IOException
- if MIME type file cannot be read
-
MimeTypeFile
Construct with mime types input stream ( from"mime.types" usually).- Parameters:
is
- input stream- Throws:
IOException
- if MIME type file cannot be read
-
MimeTypeFile
public MimeTypeFile()Creates an empty mime types registry.
-
-
Method Details
-
getMimeTypeEntry
Get a mime type entry based on the file extension.- Specified by:
getMimeTypeEntry
in interfacejakarta.activation.MimeTypeRegistry
- Parameters:
ext
- the file extension- Returns:
- one mime type entry
-
getMIMETypeString
Get a mime type entry based on the file extension.- Specified by:
getMIMETypeString
in interfacejakarta.activation.MimeTypeRegistry
- Parameters:
ext
- the file extension- Returns:
- the MIME type string
-
appendToRegistry
Appends string of entries to the types registry, must be valid mime.types format. A mime.types entry is one of two forms type/subtype ext1 ext2 ... or type=type/subtype desc="description of type" exts=ext1,ext2,... Example # this is a test audio/basic au text/plain txt text type=application/postscript exts=ps,eps- Specified by:
appendToRegistry
in interfacejakarta.activation.MimeTypeRegistry
- Parameters:
mime_types
- the mime.types string
-