19 package org.sleuthkit.datamodel;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
45 private long imageHandle = -1;
83 long dataSourceObjectId,
91 super(db, objId, dataSourceObjectId,
TSK_FS_ATTR_TYPE_ENUM.
TSK_FS_ATTR_TYPE_DEFAULT, 0, name, fileType, 0L, 0, dirType, metaType, dirFlag, metaFlags, size, 0L, 0L, 0L, 0L, (
short) 0, 0, 0, md5Hash, knownState, parentPath, mimeType, null);
104 Logger.getLogger(
LayoutFile.class.
getName()).log(Level.SEVERE, String.format(
"Error getting layout ranges for layout file (objId = %d)",
getId()), ex);
141 long offsetInThisLayoutContent = 0;
144 if (imageHandle == -1) {
146 if ((dataSource != null) && (dataSource instanceof
Image)) {
147 Image image = (Image) dataSource;
155 if (bytesRead < len) {
156 if (offset < offsetInThisLayoutContent + range.getByteLen()) {
157 long offsetInRange = 0;
158 if (bytesRead == 0) {
159 offsetInRange = offset - offsetInThisLayoutContent;
161 long offsetInImage = range.getByteStart() + offsetInRange;
162 long lenToRead = Math.min(range.getByteLen() - offsetInRange, len - bytesRead);
163 int lenRead = readImgToOffset(imageHandle, buf, bytesRead, offsetInImage, (
int) lenToRead);
164 bytesRead += lenRead;
165 if (lenToRead != lenRead) {
169 offsetInThisLayoutContent += range.getByteLen();
193 private int readImgToOffset(
long imgHandle, byte[] buf,
int offsetInBuf,
long offsetInImage,
int lenToRead)
throws TskCoreException {
194 byte[] currentBuffer =
new byte[lenToRead];
196 System.arraycopy(currentBuffer, 0, buf, offsetInBuf, lenToRead);
209 public <T> T accept(ContentVisitor<T> visitor) {
210 return visitor.visit(
this);
222 public <T> T accept(SleuthkitItemVisitor<T> visitor) {
223 return visitor.visit(
this);
234 return super.toString(preserveState) +
"LayoutFile [\t" +
"]\t";
266 @SuppressWarnings(
"deprecation")
271 long size, String md5Hash,
FileKnown knownState, String parentPath) {
272 this(db, objId, db.getDataSourceObjectId(objId), name,
fileType,
dirType,
metaType,
dirFlag,
metaFlags,
size,
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()