19 package org.sleuthkit.datamodel;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
45 private long imageHandle = -1;
87 long dataSourceObjectId,
93 long ctime,
long crtime,
long atime,
long mtime,
96 super(db, objId, dataSourceObjectId,
TSK_FS_ATTR_TYPE_ENUM.
TSK_FS_ATTR_TYPE_DEFAULT, 0, name, fileType, 0L, 0, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, (
short) 0, 0, 0, md5Hash, knownState, parentPath, mimeType,
SleuthkitCase.extractExtension(name));
109 Logger.getLogger(
LayoutFile.class.
getName()).log(Level.SEVERE, String.format(
"Error getting layout ranges for layout file (objId = %d)",
getId()), ex);
146 long offsetInThisLayoutContent = 0;
152 if (offset + readLen > size)
153 readLen = size - offset;
155 if (imageHandle == -1) {
157 if ((dataSource != null) && (dataSource instanceof
Image)) {
158 Image image = (Image) dataSource;
166 if (bytesRead < readLen) {
167 if (offset < offsetInThisLayoutContent + range.getByteLen()) {
168 long offsetInRange = 0;
169 if (bytesRead == 0) {
170 offsetInRange = offset - offsetInThisLayoutContent;
172 long offsetInImage = range.getByteStart() + offsetInRange;
173 long lenToReadInRange = Math.min(range.getByteLen() - offsetInRange, readLen - bytesRead);
174 int lenRead = readImgToOffset(imageHandle, buf, bytesRead, offsetInImage, (
int) lenToReadInRange);
175 bytesRead += lenRead;
176 if (lenToReadInRange != lenRead) {
180 offsetInThisLayoutContent += range.getByteLen();
204 private int readImgToOffset(
long imgHandle, byte[] buf,
int offsetInBuf,
long offsetInImage,
int lenToRead)
throws TskCoreException {
205 byte[] currentBuffer =
new byte[lenToRead];
207 System.arraycopy(currentBuffer, 0, buf, offsetInBuf, lenToRead);
220 public <T> T accept(ContentVisitor<T> visitor) {
221 return visitor.visit(
this);
233 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
234 return visitor.visit(
this);
245 return super.toString(preserveState) +
"LayoutFile [\t" +
"]\t";
277 @SuppressWarnings(
"deprecation")
282 long size, String md5Hash,
FileKnown knownState, String parentPath) {
283 this(db, objId, db.getDataSourceObjectId(objId), name,
fileType,
dirType,
metaType,
dirFlag,
metaFlags,
size, 0L, 0L, 0L, 0L,
md5Hash,
knownState,
parentPath, null);
final TSK_FS_NAME_TYPE_ENUM dirType
static int readImg(long imgHandle, byte[] readBuffer, long offset, long len)
final TSK_FS_NAME_FLAG_ENUM dirFlag
final TskData.TSK_DB_FILES_TYPE_ENUM fileType
String toString(boolean preserveState)
final Set< TSK_FS_META_FLAG_ENUM > metaFlags
int readInt(byte[] buf, long offset, long len)
TskData.FileKnown knownState
List< TskFileRange > getRanges()
final TSK_FS_META_TYPE_ENUM metaType
synchronized long getImageHandle()