java.lang.Object
org.codelibs.jcifs.smb1.util.MimeMap
MIME type mapping utility for file extensions.
Provides mappings between file extensions and their corresponding MIME types
by reading from a resource file containing extension-to-MIME-type mappings.
-
Constructor Summary
ConstructorsConstructorDescriptionMimeMap()Creates a new MimeMap instance by loading MIME type mappings from the resource file. -
Method Summary
Modifier and TypeMethodDescriptiongetMimeType(String extension) Returns the MIME type for the given file extension.getMimeType(String extension, String def) Returns the MIME type for the given file extension with a custom default.
-
Constructor Details
-
MimeMap
Creates a new MimeMap instance by loading MIME type mappings from the resource file.- Throws:
IOException- if there is an error reading the mime.map resource file
-
-
Method Details
-
getMimeType
Returns the MIME type for the given file extension. If no mapping is found, returns "application/octet-stream" as the default.- Parameters:
extension- the file extension to look up (without the dot)- Returns:
- the MIME type for the extension, or "application/octet-stream" if not found
- Throws:
IOException- if there is an error processing the MIME mappings
-
getMimeType
Returns the MIME type for the given file extension with a custom default.- Parameters:
extension- the file extension to look up (without the dot)def- the default MIME type to return if no mapping is found- Returns:
- the MIME type for the extension, or the specified default if not found
- Throws:
IOException- if there is an error processing the MIME mappings
-