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 StringRepresents 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 StringgetMimeType(byte[] data) This method gets the MIME type of the data available in the provided byte array.static voidinit(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 voidThis 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_TYPEif 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 anInputStreamcontaining MIME type definitions.magicStream- Specifies anInputStreamcontaining 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.
 
 -