public final class ChmMediaTypeDetector extends MediaTypeDetector
Provides the functionality to detect the media type of CHM.
Usage:
// Create a media type detector
ChmMediaTypeDetector detector = new ChmMediaTypeDetector();
// Detect a media type by the file name
System.out.println(detector.detect("file.chm")); // APPLICATION/VND.MS-HTMLHELP if supported or NULL otherwise
// Detect a media type by the content
System.out.println(detector.detect(stream)); // APPLICATION/VND.MS-HTMLHELP if supported or NULL otherwise
Constructor and Description |
---|
ChmMediaTypeDetector()
Initializes a new instance of the
ChmMediaTypeDetector class. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkMediaType(String mediaType)
Detects whether the
mediaType is supported by the detector. |
protected String |
detectByContent(InputStream stream,
LoadOptions loadOptions)
Detects the media type by the content of the
stream . |
protected String |
detectByExt(String ext)
Detects the media type by the
ext . |
detect, detect, detect, detectByContent, supports
public ChmMediaTypeDetector()
Initializes a new instance of the ChmMediaTypeDetector
class.
protected String detectByContent(InputStream stream, LoadOptions loadOptions)
Detects the media type by the content of the stream
.
detectByContent
in class MediaTypeDetector
stream
- Stream of the document.loadOptions
- The options of loading the file.protected String detectByExt(String ext)
Detects the media type by the ext
.
detectByExt
in class MediaTypeDetector
ext
- The extension of the file in the UPPER case.protected boolean checkMediaType(String mediaType)
Detects whether the mediaType
is supported by the detector.
checkMediaType
in class MediaTypeDetector
mediaType
- A string with media type in the UPPER case.Copyright © 2019. All rights reserved.