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();
50 for (BlackboardAttribute attribute : artifact.getAttributes()) {
51 artifactContents.append(attribute.getAttributeType().getDisplayName());
52 artifactContents.append(
" : ");
58 switch (attribute.getValueType()) {
63 artifactContents.append(attribute.getDisplayString());
65 artifactContents.append(System.lineSeparator());
67 }
catch (TskCoreException tskCoreException) {
68 throw new InitReaderException(
"Unable to get attributes for artifact: " + artifact.toString(), tskCoreException);
71 return new InputStreamReader(IOUtils.toInputStream(artifactContents,
72 StandardCharsets.UTF_8), StandardCharsets.UTF_8);
76 public boolean isSupported() {
static String getStringTime(long epochSeconds, TimeZone tzone)