commenting

This commit is contained in:
Greg DiCristofaro 2021-06-22 09:22:58 -04:00
parent 8c1b7feb94
commit 8293b38d1a

View File

@ -158,7 +158,7 @@ final class TikaTextExtractor implements TextExtractor {
"application/pdf", "application/pdf",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
); );
private static final String IMAGE_MIME_TYPE_PREFIX = "image/"; private static final String IMAGE_MIME_TYPE_PREFIX = "image/";
private Map<String, String> metadataMap; private Map<String, String> metadataMap;
@ -183,6 +183,16 @@ final class TikaTextExtractor implements TextExtractor {
this.fileTypeDetector = detector; this.fileTypeDetector = detector;
} }
/**
* Obtains the mime type of the file using a FileTypeDetector with the
* file's mime type as fallback if the FileTypeDetector is not instantiated.
* If no mime type present, MimeTypes.OCTET_STREAM is returned.
*
* @param file The abstract file instance.
*
* @return The mime type or MimeTypes.OCTET_STREAM if the mime type cannot
* be determined.
*/
private String getMimeType(AbstractFile file) { private String getMimeType(AbstractFile file) {
String mimeType = MimeTypes.OCTET_STREAM; String mimeType = MimeTypes.OCTET_STREAM;
if (fileTypeDetector != null) { if (fileTypeDetector != null) {