19 package org.sleuthkit.autopsy.textextractors;
21 import java.io.InputStreamReader;
22 import java.io.Reader;
23 import java.nio.charset.StandardCharsets;
24 import org.apache.commons.io.IOUtils;
37 private final BlackboardArtifact artifact;
39 public ArtifactTextExtractor(BlackboardArtifact artifact) {
40 this.artifact = artifact;
44 public Reader getReader()
throws InitReaderException {
47 StringBuilder artifactContents =
new StringBuilder();
49 Content dataSource = null;
51 dataSource = artifact.getDataSource();
52 }
catch (TskCoreException tskCoreException) {
53 throw new InitReaderException(
"Unable to get datasource for artifact: " + artifact.toString(), tskCoreException);
55 if (dataSource == null) {
56 throw new InitReaderException(
"Datasource was null for artifact: " + artifact.toString());
60 for (BlackboardAttribute attribute : artifact.getAttributes()) {
61 artifactContents.append(attribute.getAttributeType().getDisplayName());
62 artifactContents.append(
" : ");
68 switch (attribute.getValueType()) {
73 artifactContents.append(attribute.getDisplayString());
75 artifactContents.append(System.lineSeparator());
77 }
catch (TskCoreException tskCoreException) {
78 throw new InitReaderException(
"Unable to get attributes for artifact: " + artifact.toString(), tskCoreException);
81 return new InputStreamReader(IOUtils.toInputStream(artifactContents,
82 StandardCharsets.UTF_8), StandardCharsets.UTF_8);
86 public boolean isSupported() {
static String getStringTime(long epochSeconds, TimeZone tzone)