Package com.jk.core.mime
Class MimeUtil
java.lang.Object
com.jk.core.mime.MimeUtil
This class is an utility class for the MIME types.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Represents the unknown MIME type path filename used for types that aren't defined yet in the framework. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getMimeType
(byte[] data) This method gets the MIME type of the data available in the provided byte array.static void
init
(InputStream mimeTypes, InputStream magicStream) This method initializes the Magic MIME database by loading MIME types and parsing magic rules from the provided input streams.static void
This main method is currently empty.
-
Field Details
-
UNKNOWN_MIME_TYPE
Represents the unknown MIME type path filename used for types that aren't defined yet in the framework.- See Also:
-
-
Constructor Details
-
MimeUtil
public MimeUtil()
-
-
Method Details
-
getMimeType
This method gets the MIME type of the data available in the provided byte array.- Parameters:
data
- Specifies the data to be tested- Returns:
- the MIME type, or
UNKNOWN_MIME_TYPE
if no match is found.
-
init
This method initializes the Magic MIME database by loading MIME types and parsing magic rules from the provided input streams.This method is typically called during application startup to configure the Magic MIME database.
- Parameters:
mimeTypes
- Specifies anInputStream
containing MIME type definitions.magicStream
- Specifies anInputStream
containing magic rule definitions.- Throws:
IOException
- if an I/O exception has occurred.
-
main
This main method is currently empty.- Parameters:
args
- the command line arguments.- Throws:
FileNotFoundException
- if the file was not found.IOException
- if an I/O exception has occurred.
-