Sleuth Kit Java Bindings (JNI)  4.2
Java bindings for using The Sleuth Kit
LocalFile.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2013 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;
23 import java.util.logging.Logger;
30 
34 public class LocalFile extends AbstractFile {
35 
36  private static final Logger logger = Logger.getLogger(LocalFile.class.getName());
37 
64  short metaFlags, long size,
65  long ctime, long crtime, long atime, long mtime,
66  String md5Hash,
67  FileKnown knownState, String parentPath, String localPath) {
68  super(db, objId, TSK_FS_ATTR_TYPE_ENUM.TSK_FS_ATTR_TYPE_DEFAULT, (short) 0,
69  name, fileType, 0L, 0, dirType, metaType, dirFlag,
70  metaFlags, size, ctime, crtime, atime, mtime, (short) 0, 0, 0, md5Hash, knownState, parentPath);
71 
72  //use the local path functionality of AbstractFile, this sets up the infrastructure for it
73  super.setLocalPath(localPath, true); //local paths for local files are absolute paths
74  }
75 
102  long ctime, long crtime, long atime, long mtime,
103  String md5Hash, FileKnown knownState, String parentPath, String localPath, long parentId) {
104  this(db, objId, name, fileType, dirType, metaType, dirFlag, metaFlags, size, ctime, crtime, atime, mtime, md5Hash, knownState, parentPath, localPath);
105 
106  if (parentId > 0) {
107  setParentId(parentId);
108  }
109 
110  }
111 
135  long ctime, long crtime, long atime, long mtime,
136  String md5Hash, FileKnown knownState, String parentPath, String localPath, long parentId) {
138  }
139 
140  @Override
141  public List<TskFileRange> getRanges() throws TskCoreException {
142  return Collections.<TskFileRange>emptyList();
143  }
144 
145  @Override
146  public boolean isRoot() {
147  //not a root of a fs, since it always has a parent
148  return false;
149  }
150 
151  @Override
152  public <T> T accept(ContentVisitor<T> v) {
153  return v.visit(this);
154  }
155 
156  @Override
157  public List<Content> getChildren() throws TskCoreException {
158  //local file/dir children, can only be other local or derived files
159  final SleuthkitCase tskCase = getSleuthkitCase();
160  final List<Content> ret = tskCase.getAbstractFileChildren(this, TSK_DB_FILES_TYPE_ENUM.DERIVED);
161  ret.addAll(tskCase.getAbstractFileChildren(this, TSK_DB_FILES_TYPE_ENUM.LOCAL));
162 
163  return ret;
164  }
165 
166  @Override
167  public List<Long> getChildrenIds() throws TskCoreException {
168  //local file/dir children, can only be other local or derived files
169  final SleuthkitCase tskCase = getSleuthkitCase();
170  final List<Long> ret = tskCase.getAbstractFileChildrenIds(this, TSK_DB_FILES_TYPE_ENUM.DERIVED);
171  ret.addAll(tskCase.getAbstractFileChildrenIds(this, TSK_DB_FILES_TYPE_ENUM.LOCAL));
172 
173  return ret;
174  }
175 
176  @Override
177  public <T> T accept(SleuthkitItemVisitor<T> v) {
178  return v.visit(this);
179  }
180 
181  @Override
182  public String toString(boolean preserveState) {
183  return super.toString(preserveState) + "LocalFile [\t" + "]\t"; //NON-NLS
184  }
185 }
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:182
LOCAL
Local file that was added (not from a disk image)
Definition: TskData.java:647
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:134
DERIVED
File derived from a parent file (i.e. from ZIP)
Definition: TskData.java:646
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)
Definition: LocalFile.java:62
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:101
static final Logger logger
Definition: LocalFile.java:36
final TSK_FS_META_TYPE_ENUM metaType
List< TskFileRange > getRanges()
Definition: LocalFile.java:141

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.