19 package org.sleuthkit.datamodel;
21 import java.util.ResourceBundle;
22 import java.util.ArrayList;
23 import java.util.List;
32 private long startSector;
33 private long lengthInSectors;
36 private volatile long volumeHandle = 0;
37 private volatile String uniquePath;
38 private static ResourceBundle bundle = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle");
51 protected Volume(
SleuthkitCase db,
long obj_id,
long addr,
long startSector,
long lengthInSectors,
long flags, String desc) {
52 super(db, obj_id,
"vol" + Long.toString(addr));
54 this.startSector = startSector;
55 this.lengthInSectors = lengthInSectors;
56 this.uniquePath = null;
58 if (!desc.equals(
"")) {
61 this.desc = bundle.getString(
"Volume.desc.text");
70 throw new TskCoreException(bundle.getString(
"Volume.read.exception.msg1.text"));
72 VolumeSystem parentVs = (VolumeSystem) myParent;
80 if (volumeHandle == 0) {
106 return lengthInSectors * 512;
113 if(uniquePath == null) {
114 String tempUniquePath =
"";
116 if (!name.isEmpty()) {
117 tempUniquePath =
"/vol_" + name;
121 if (myParent != null) {
126 uniquePath = tempUniquePath;
159 return lengthInSectors;
203 if (flag.getVsFlag() == vsFlag) {
204 result = flag.toString();
222 if (flag.toString().equals(vsFlag)) {
223 result = flag.getVsFlag();
247 if ((vsFlag & allocFlag) == allocFlag) {
248 result = bundle.getString(
"Volume.vsFlagToString.allocated");
250 if ((vsFlag & unallocFlag) == unallocFlag) {
251 result = bundle.getString(
"Volume.vsFlagToString.unallocated");
260 return v.
visit(
this);
264 public <T> T accept(ContentVisitor<T> v) {
265 return v.visit(
this);
286 List<FileSystem> fileSystems =
new ArrayList<FileSystem>();
287 for (
Content child : children) {
289 fileSystems.add((FileSystem) child);
298 return super.toString(preserveState) +
"Volume [\t" +
"addr " + addr +
"\t" +
"desc " + desc +
"\t" +
"flags " + flags +
"\t" +
"length " + lengthInSectors +
"\t" +
"start " + startSector +
"]\t";
TSK_VS_PART_FLAG_ALL
Show all sectors in the walk.
static long valueToVsFlag(String vsFlag)
TSK_VS_PART_FLAG_ALLOC
Sectors are allocated to a volume in the volume system.
int read(byte[] buf, long offset, long len)
List< FileSystem > getFileSystems()
TSK_VS_TYPE_APFS
APFS pool NON-NLS.
synchronized long getVolumeSystemHandle()
String toString(boolean preserveState)
TSK_VS_PART_FLAG_META
Sectors contain volume system metadata and could also be ALLOC or UNALLOC.
Volume(SleuthkitCase db, long obj_id, long addr, long startSector, long lengthInSectors, long flags, String desc)
static int readVsPart(long volHandle, byte[] readBuffer, long offset, long len)
List< Long > getChildrenIds()
String getFlagsAsString()
static String vsFlagToValue(long vsFlag)
List< Content > getChildren()
SleuthkitCase getSleuthkitCase()
static long openVsPart(long vsHandle, long volId)
TSK_VS_PART_FLAG_UNALLOC
Sectors are not allocated to a volume.
TSK_VS_TYPE_ENUM getType()
static String vsFlagToString(long vsFlag)