19 package org.sleuthkit.autopsy.textextractors;
21 import java.io.BufferedInputStream;
22 import java.io.IOException;
23 import java.io.InputStreamReader;
24 import java.io.Reader;
25 import java.nio.charset.Charset;
26 import java.nio.charset.StandardCharsets;
27 import java.util.logging.Level;
28 import org.apache.commons.lang.StringUtils;
42 private final AbstractFile
file;
58 if(encoding == null) {
62 encoding = StandardCharsets.UTF_8;
64 }
catch (TskCoreException | IOException ex) {
65 logger.log(Level.WARNING, String.format(
"Error detecting the "
66 +
"encoding for %s (objID=%d)", file.getName(), file.getId()), ex);
67 encoding = StandardCharsets.UTF_8;
75 return new InputStreamReader(
new BufferedInputStream(
new ReadContentInputStream(file)), encoding);
81 String mimeType = file.getMIMEType();
84 if (StringUtils.isEmpty(mimeType)) {
89 logger.log(Level.SEVERE,
"Unable to create file type detector for determining MIME type", ex);
95 return PLAIN_TEXT_MIME_TYPE.equals(mimeType);
static final Charset UNKNOWN_CHARSET
String getMIMEType(AbstractFile file)
static Charset getEncoding(AbstractFile file)
synchronized static Logger getLogger(String name)