19 package org.sleuthkit.autopsy.textreaders;
21 import java.io.InputStreamReader;
22 import java.io.Reader;
23 import java.nio.charset.StandardCharsets;
24 import org.apache.commons.io.IOUtils;
35 class ArtifactTextExtractor
extends TextExtractor {
37 private final BlackboardArtifact artifact;
39 public ArtifactTextExtractor(Content artifact) {
40 this.artifact = (BlackboardArtifact) artifact;
47 StringBuilder artifactContents =
new StringBuilder();
49 Content dataSource = null;
51 dataSource = artifact.getDataSource();
52 }
catch (TskCoreException tskCoreException) {
53 throw new ExtractionException(
"Unable to get datasource for artifact: " + artifact.toString(), tskCoreException);
55 if (dataSource == null) {
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 ExtractionException(
"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(Content file, String detectedFormat) {
static String getStringTime(long epochSeconds, TimeZone tzone)