// Calculate the offset and length of the embedded HFS+ file system
long offset = mdb.getAllocationBlockStart() * 512 +
mdb.getEmbeddedVolumeStartBlock() * mdb.getAllocationBlockSize();
long length = mdb.getEmbeddedVolumeBlockCount() * mdb.getAllocationBlockSize();
MappedBlockDeviceSupport subDevice;
try {
// Take a sub-section of the device to pass down to the HFS+ code
subDevice = new MappedBlockDeviceSupport(device, offset, length);
} catch (IOException e) {
throw new FileSystemException("Error creating sub-device for HFS+", e);
}
HfsPlusFileSystem fs = new HfsPlusFileSystem(subDevice, readOnly, this);