Class WindowsRegistryMimeDetector
This MimeDetector will only operate on Windows machines. On any other platform the methods throw a UnsupportedOperationException (These are swallowed by the MimeUtil class) Therefore, it is perfectly acceptable to register this MimeDetector with MimeUtil and it will only be used on a Windows Platform. On all other platforms it will just be ignored.
To register this MimeDetector use
MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.WindowsRegistryMimeDetector");
The Collection returned from the getMimeTypesXXX(...) Methods with contain either a single MimeType or the collection will be empty.
This MimeDetector only performs file extension mapping, so the methods taking an InputStream and byte array throw UnsupportedOperationException
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAbstract method to be implement by concrete MimeDetector(s).getMimeTypesByteArray
(byte[] data) Content detection not supportedgetMimeTypesFile
(File file) Abstract method that must be implemented by concrete MimeDetector(s).getMimeTypesFileName
(String fileName) Abstract method that must be implemented by concrete MimeDetector(s).Content detection not supportedgetMimeTypesURL
(URL url) Abstract method that must be implemented by concrete MimeDetector(s).Methods inherited from class eu.medsea.mimeutil.detector.MimeDetector
closeStream, delete, getMimeTypes, getMimeTypes, getMimeTypes, getMimeTypes, getMimeTypes, getName, init
-
Constructor Details
-
WindowsRegistryMimeDetector
public WindowsRegistryMimeDetector()
-
-
Method Details
-
getDescription
Description copied from class:MimeDetector
Abstract method to be implement by concrete MimeDetector(s).- Specified by:
getDescription
in classMimeDetector
- Returns:
- description of this MimeDetector
-
getMimeTypesFile
Description copied from class:MimeDetector
Abstract method that must be implemented by concrete MimeDetector(s). This takes a file object and is called by the MimeUtil getMimeTypes(File file) method. If your MimeDetector does not handle file names then either throw an UnsupportedOperationException or return an empty collection.- Specified by:
getMimeTypesFile
in classMimeDetector
- Parameters:
file
-- Returns:
- Collection of matched MimeType(s)
- Throws:
UnsupportedOperationException
-
getMimeTypesFileName
Description copied from class:MimeDetector
Abstract method that must be implemented by concrete MimeDetector(s). This takes a file name and is called by the MimeUtil getMimeTypes(String fileName) getMimeTypes(File file) getMimeTypes(URL url) methods. If your MimeDetector does not handle file names then either throw an UnsupportedOperationException or return an empty collection.- Specified by:
getMimeTypesFileName
in classMimeDetector
- Parameters:
fileName
-- Returns:
- Collection of matched MimeType(s)
- Throws:
UnsupportedOperationException
-
getMimeTypesURL
Description copied from class:MimeDetector
Abstract method that must be implemented by concrete MimeDetector(s). This takes a URL object and is called by the MimeUtil getMimeTypes(URL url) method. If your MimeDetector does not handle file names then either throw an UnsupportedOperationException or return an empty collection.- Specified by:
getMimeTypesURL
in classMimeDetector
- Returns:
- Collection of matched MimeType(s)
- Throws:
UnsupportedOperationException
-
getMimeTypesByteArray
Content detection not supported- Specified by:
getMimeTypesByteArray
in classMimeDetector
- Parameters:
data
- byte []. Is a byte array that you want to parse for matching mime types.- Returns:
- Collection of matched MimeType(s)
- Throws:
UnsupportedOperationException
-
getMimeTypesInputStream
Content detection not supported- Specified by:
getMimeTypesInputStream
in classMimeDetector
- Parameters:
in
- InputStream.- Returns:
- Collection of matched MimeType(s)
- Throws:
UnsupportedOperationException
-