Sleuth Kit Java Bindings (JNI)  4.3
Java bindings for using The Sleuth Kit
LocalFile.java
Go to the documentation of this file.
1 /*
2  * SleuthKit Java Bindings
3  *
4  * Copyright 2011-2016 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.datamodel;
20 
21 import java.util.Collections;
22 import java.util.List;
29 
34 public class LocalFile extends AbstractFile {
35 
76  long objId,
77  String name,
81  long size,
82  long ctime, long crtime, long atime, long mtime,
83  String mimeType, String md5Hash, FileKnown knownState,
84  long parentId, String parentPath,
85  long dataSourceObjectId,
86  String localPath,
88  super(db, objId, dataSourceObjectId, TSK_FS_ATTR_TYPE_ENUM.TSK_FS_ATTR_TYPE_DEFAULT, 0,
89  name, fileType, 0L, 0, dirType, metaType, dirFlag,
90  metaFlags, size, ctime, crtime, atime, mtime, (short) 0, 0, 0, md5Hash, knownState, parentPath, mimeType);
91  // TODO (AUT-1904): The parent id should be passed to AbstractContent
92  // through the class hierarchy contructors, using
93  // AbstractContent.UNKNOWN_ID as needed.
94  if (parentId > 0) {
95  setParentId(parentId);
96  }
97  super.setLocalFilePath(localPath, true);
98  setEncodingType(encodingType);
99  }
100 
110  @Override
111  public List<TskFileRange> getRanges() throws TskCoreException {
112  return Collections.<TskFileRange>emptyList();
113  }
114 
121  @Override
122  public boolean isRoot() {
123  return false;
124  }
125 
135  @Override
136  public List<Content> getChildren() throws TskCoreException {
137  final SleuthkitCase tskCase = getSleuthkitCase();
138  final List<Content> children = tskCase.getAbstractFileChildren(this, TSK_DB_FILES_TYPE_ENUM.DERIVED);
139  children.addAll(tskCase.getAbstractFileChildren(this, TSK_DB_FILES_TYPE_ENUM.LOCAL));
140  return children;
141  }
142 
152  @Override
153  public List<Long> getChildrenIds() throws TskCoreException {
154  final SleuthkitCase tskCase = getSleuthkitCase();
155  final List<Long> childIds = tskCase.getAbstractFileChildrenIds(this, TSK_DB_FILES_TYPE_ENUM.DERIVED);
156  childIds.addAll(tskCase.getAbstractFileChildrenIds(this, TSK_DB_FILES_TYPE_ENUM.LOCAL));
157  return childIds;
158  }
159 
168  @Override
169  public <T> T accept(ContentVisitor<T> v) {
170  return v.visit(this);
171  }
172 
181  @Override
182  public <T> T accept(SleuthkitItemVisitor<T> v) {
183  return v.visit(this);
184  }
185 
195  @Override
196  public String toString(boolean preserveState) {
197  return super.toString(preserveState) + "LocalFile [\t" + "]\t"; //NON-NLS
198  }
199 
231  @Deprecated
232  @SuppressWarnings("deprecation")
233  protected LocalFile(SleuthkitCase db,
234  long objId,
235  String name,
236  TSK_DB_FILES_TYPE_ENUM fileType,
238  TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags,
239  long size,
240  long ctime, long crtime, long atime, long mtime,
241  String md5Hash, FileKnown knownState,
242  String parentPath,
243  String localPath) {
244  this(db,
245  objId,
246  name,
247  fileType,
248  dirType, metaType,
250  size,
251  ctime, crtime, atime, mtime,
252  null, md5Hash, knownState,
254  db.getDataSourceObjectId(objId),
255  localPath,
257  }
258 
291  @Deprecated
292  protected LocalFile(SleuthkitCase db,
293  long objId,
294  String name,
295  TSK_DB_FILES_TYPE_ENUM fileType,
297  TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags,
298  long size,
299  long ctime, long crtime, long atime, long mtime,
300  String md5Hash, FileKnown knownState,
301  String parentPath, String localPath, long parentId) {
302  this(db, objId, name, fileType, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, md5Hash, knownState, parentPath, localPath);
303  }
304 
336  @Deprecated
337  protected LocalFile(SleuthkitCase db,
338  long objId,
339  String name,
341  TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags,
342  long size,
343  long ctime, long crtime, long atime, long mtime,
344  String md5Hash, FileKnown knownState,
345  String parentPath, String localPath, long parentId) {
347  }
348 }
final TSK_FS_NAME_TYPE_ENUM dirType
final TSK_FS_NAME_FLAG_ENUM dirFlag
final TskData.TSK_DB_FILES_TYPE_ENUM fileType
String toString(boolean preserveState)
Definition: LocalFile.java:196
LOCAL
Local file that was added (not from a disk image)
Definition: TskData.java:659
final Set< TSK_FS_META_FLAG_ENUM > metaFlags
String localPath
local path as stored in db tsk_files_path, is relative to the db,
LocalFile(SleuthkitCase db, long objId, String name, TSK_FS_NAME_TYPE_ENUM dirType, TSK_FS_META_TYPE_ENUM metaType, TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, long size, long ctime, long crtime, long atime, long mtime, String md5Hash, FileKnown knownState, String parentPath, String localPath, long parentId)
Definition: LocalFile.java:337
DERIVED
File derived from a parent file (i.e. from ZIP)
Definition: TskData.java:658
LocalFile(SleuthkitCase db, long objId, String name, TSK_DB_FILES_TYPE_ENUM fileType, TSK_FS_NAME_TYPE_ENUM dirType, TSK_FS_META_TYPE_ENUM metaType, TSK_FS_NAME_FLAG_ENUM dirFlag, short metaFlags, long size, long ctime, long crtime, long atime, long mtime, String md5Hash, FileKnown knownState, String parentPath, String localPath, long parentId)
Definition: LocalFile.java:292
final TSK_FS_META_TYPE_ENUM metaType
List< TskFileRange > getRanges()
Definition: LocalFile.java:111

Copyright © 2011-2015 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.