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;
36 private final BlackboardArtifact artifact;
38 public ArtifactTextExtractor(BlackboardArtifact artifact) {
39 this.artifact = artifact;
43 public Reader getReader()
throws InitReaderException {
46 StringBuilder artifactContents =
new StringBuilder();
49 for (BlackboardAttribute attribute : artifact.getAttributes()) {
50 artifactContents.append(attribute.getAttributeType().getDisplayName());
51 artifactContents.append(
" : ");
57 switch (attribute.getValueType()) {
62 artifactContents.append(attribute.getDisplayString());
64 artifactContents.append(System.lineSeparator());
66 }
catch (TskCoreException tskCoreException) {
67 throw new InitReaderException(
"Unable to get attributes for artifact: " + artifact.toString(), tskCoreException);
70 return new InputStreamReader(IOUtils.toInputStream(artifactContents,
71 StandardCharsets.UTF_8), StandardCharsets.UTF_8);
75 public boolean isSupported() {
static String getFormattedTime(long epochTime)