19 package org.sleuthkit.autopsy.datamodel;
21 import java.text.SimpleDateFormat;
22 import java.util.Arrays;
23 import java.util.TimeZone;
24 import java.util.logging.Level;
26 import org.openide.util.NbBundle;
46 private static SimpleDateFormat
dateFormatter =
new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
54 if (stringContent.isEmpty()) {
56 StringBuilder buffer =
new StringBuilder();
57 buffer.append(
"<html>\n");
58 buffer.append(
"<body>\n");
61 buffer.append(
"<h4>");
63 buffer.append(
"</h4>\n");
66 buffer.append(
"<table border='0'>");
67 buffer.append(
"<tr>");
68 buffer.append(
"</tr>\n");
74 buffer.append(
"<tr><td>");
75 buffer.append(attr.getAttributeTypeDisplayName());
76 buffer.append(
"</td>");
79 buffer.append(
"<td>");
88 long epoch = attr.getValueLong();
89 String time =
"0000-00-00 00:00:00";
92 time = dateFormatter.format(
new java.util.Date(epoch * 1000));
96 switch (attr.getValueType()) {
98 String str = attr.getValueString();
99 str = str.replaceAll(
" ",
" ");
100 str = str.replaceAll(
"<",
"<");
101 str = str.replaceAll(
">",
">");
102 str = str.replaceAll(
"(\r\n|\n)",
"<br />");
106 buffer.append(attr.getValueInt());
109 buffer.append(attr.getValueLong());
112 buffer.append(attr.getValueDouble());
115 buffer.append(Arrays.toString(attr.getValueBytes()));
119 if (!
"".equals(attr.getContext())) {
121 buffer.append(attr.getContext());
124 buffer.append(
"</td>");
125 buffer.append(
"</tr>\n");
134 logger.log(Level.SEVERE,
"Exception while calling Content.getUniquePath() on {0} : {1}",
new Object[]{content, ex.getLocalizedMessage()});
139 buffer.append(
"<tr>");
140 buffer.append(
"<td>");
141 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.srcFilePath.text"));
142 buffer.append(
"</td>");
143 buffer.append(
"<td>");
145 buffer.append(
"</td>");
146 buffer.append(
"</tr>\n");
150 buffer.append(
"<tr><td>");
151 buffer.append(NbBundle.getMessage(
this.getClass(),
"ArtifactStringContent.getStr.artifactId.text"));
152 buffer.append(
"</td><td>");
154 buffer.append(
"</td>");
155 buffer.append(
"</tr>\n");
158 buffer.append(
"</table>");
159 buffer.append(
"</html>\n");
161 stringContent = buffer.toString();
163 stringContent = NbBundle.getMessage(this.getClass(),
"ArtifactStringContent.getStr.err");
174 logger.log(Level.WARNING,
"Getting file failed", ex);
176 throw new IllegalArgumentException(NbBundle.getMessage(
ArtifactStringContent.class,
"ArtifactStringContent.exception.msg"));
static SimpleDateFormat dateFormatter
Content getContentById(long id)
SleuthkitCase getSleuthkitCase()
static Content getAssociatedContent(BlackboardArtifact artifact)
static TimeZone getTimeZone(BlackboardArtifact artifact)
List< BlackboardAttribute > getAttributes()
static TimeZone getTimeZone(Content c)
ArtifactStringContent(BlackboardArtifact art)
static Logger getLogger(String name)