mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Cleaned up the logic to be less verbose
This commit is contained in:
parent
d28a857599
commit
dd17770a05
@ -148,24 +148,15 @@ final class TikaTextExtractor implements TextExtractor {
|
|||||||
public TikaTextExtractor(Content content) {
|
public TikaTextExtractor(Content content) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
|
|
||||||
if (!(content instanceof AbstractFile)) {
|
|
||||||
parser = new AutoDetectParser();
|
parser = new AutoDetectParser();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (content instanceof AbstractFile) {
|
||||||
AbstractFile file = (AbstractFile) content;
|
AbstractFile file = (AbstractFile) content;
|
||||||
if (file.getMIMEType() == null) {
|
if(file.getMIMEType() != null) {
|
||||||
parser = new AutoDetectParser();
|
//Set the Tika logic to use the pre-computed mime type
|
||||||
} else {
|
parser.setDetector((InputStream inStream, Metadata metaData) ->
|
||||||
parser = new AutoDetectParser(new Detector() {
|
MediaType.parse(file.getMIMEType()));
|
||||||
/**
|
|
||||||
* Set the Tika logic to use the pre-computed mime type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MediaType detect(InputStream in, Metadata mtdt) throws IOException {
|
|
||||||
return MediaType.parse(file.getMIMEType());
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user