// Path: src/com/ciphertechsolutions/io/device/Device.java
// public abstract class Device {
// 
//     /**
//      *  The simple name of a device.
//      */
//     protected String name;
// 
//     /// The path to read the device with.
//     protected String path;
// 
//     /**
//      *  The size of the device in bytes.
//      */
//     protected long size;
// 
//     /**
//      * Gives detailed information about this device as a printable string.
//      * @return A printable string of device information.
//      */
//     public abstract String details();
// 
//     /**
//      * Converts the device name to a format appropriate for outputting as a file name. Does not include file extension.
//      * @return A valid file name containing device-relevant information.
//      */
//     public abstract String toFileNameString();
// 
//     /**
//      *
//      * @return The device path.
//      */
//     public Path getPath() {
//     	return Paths.get(path);
//     }
// 
//     /**
//      * @return the name
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * @param name the name to set
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Get the device serial number
//      * @return The serial number.
//      */
//     public abstract String getSerialNumber();
// 
//     protected static String trimPropertyName(String s) {
//         if (s.contains(":")) {
//             return s.substring(s.indexOf(":") + 1).trim();
//         }
//         return s;
//     }
// 
//     /**
//      * @return the size
//      */
//     public long getSize() {
//         return size;
//     }
// 
//     /**
//      * @param size the size to set
//      */
//     public void setSize(long size) {
//         this.size = size;
//     }
// }


import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.zip.Adler32;
import com.ciphertechsolutions.io.device.Device;
package com.ciphertechsolutions.io.ewf;



/**
 * A class to represent the Volume section in the Encase6 format.
 */
public class VolumeSection extends Section {

    static final int ADDITIONAL_SECTION_SIZE = 1052;

	//TODO: Enum?
    //0x00 => removable disk
    // 0x01 => fixed disk
    // 0x03 => optical disk
    // 0x0e => Logical evidence file (LEV or L01)
    // 0x10 => memory (RAM/process)
	MediaType mediaType;

    byte[] unknown = { 0x00, 0x00, 0x00 };

    int chunkCount;

    // TODO: Have the chunker set these, or be set from these.
    int sectorsPerChunk;

    int bytesPerSector;

    //TODO: Confirm long vs int
    long sectorCount;

    int cylinders;
    // Per cylinder, I think
    int heads;
    // Per head, I think
    int sectors;

    int mediaFlag;

    int IS_IMAGE_FILE_FLAG = 0x01;
    int IS_PHYSICAL_FLAG = 0x02;
    int FASTBLOC_USED_FLAG = 0x04;
    int TABLEAU_BLOCK_USED_FLAG = 0x08;


    // ???
    int palmVolumeStartSector;

    byte[] unknown2 = {0x00, 0x00, 0x00, 0x00};

    int smartLogStartSector;

    // I don't think this corresponds exactly to zlib levels, unsure though.
    int compressionLevel;


    //TODO: Tie this to our error handling in drive reader?
    int errorGranularity;

    byte[] unknown3 = {0x00, 0x00, 0x00, 0x00};

    byte[] fileSetGUID = new byte[16];

    // I am not typing this one out.
    byte[] unknown4 = new byte[963];

    //???
    byte[] signature = new byte[5];

    int secondaryAdler32 = 0;

// Path: src/com/ciphertechsolutions/io/device/Device.java
// public abstract class Device {
// 
//     /**
//      *  The simple name of a device.
//      */
//     protected String name;
// 
//     /// The path to read the device with.
//     protected String path;
// 
//     /**
//      *  The size of the device in bytes.
//      */
//     protected long size;
// 
//     /**
//      * Gives detailed information about this device as a printable string.
//      * @return A printable string of device information.
//      */
//     public abstract String details();
// 
//     /**
//      * Converts the device name to a format appropriate for outputting as a file name. Does not include file extension.
//      * @return A valid file name containing device-relevant information.
//      */
//     public abstract String toFileNameString();
// 
//     /**
//      *
//      * @return The device path.
//      */
//     public Path getPath() {
//     	return Paths.get(path);
//     }
// 
//     /**
//      * @return the name
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * @param name the name to set
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Get the device serial number
//      * @return The serial number.
//      */
//     public abstract String getSerialNumber();
// 
//     protected static String trimPropertyName(String s) {
//         if (s.contains(":")) {
//             return s.substring(s.indexOf(":") + 1).trim();
//         }
//         return s;
//     }
// 
//     /**
//      * @return the size
//      */
//     public long getSize() {
//         return size;
//     }
// 
//     /**
//      * @param size the size to set
//      */
//     public void setSize(long size) {
//         this.size = size;
//     }
// }


// Path: src/com/ciphertechsolutions/io/ewf/VolumeSection.java
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.zip.Adler32;
import com.ciphertechsolutions.io.device.Device;

package com.ciphertechsolutions.io.ewf;



/**
 * A class to represent the Volume section in the Encase6 format.
 */
public class VolumeSection extends Section {

    static final int ADDITIONAL_SECTION_SIZE = 1052;

	//TODO: Enum?
    //0x00 => removable disk
    // 0x01 => fixed disk
    // 0x03 => optical disk
    // 0x0e => Logical evidence file (LEV or L01)
    // 0x10 => memory (RAM/process)
	MediaType mediaType;

    byte[] unknown = { 0x00, 0x00, 0x00 };

    int chunkCount;

    // TODO: Have the chunker set these, or be set from these.
    int sectorsPerChunk;

    int bytesPerSector;

    //TODO: Confirm long vs int
    long sectorCount;

    int cylinders;
    // Per cylinder, I think
    int heads;
    // Per head, I think
    int sectors;

    int mediaFlag;

    int IS_IMAGE_FILE_FLAG = 0x01;
    int IS_PHYSICAL_FLAG = 0x02;
    int FASTBLOC_USED_FLAG = 0x04;
    int TABLEAU_BLOCK_USED_FLAG = 0x08;


    // ???
    int palmVolumeStartSector;

    byte[] unknown2 = {0x00, 0x00, 0x00, 0x00};

    int smartLogStartSector;

    // I don't think this corresponds exactly to zlib levels, unsure though.
    int compressionLevel;


    //TODO: Tie this to our error handling in drive reader?
    int errorGranularity;

    byte[] unknown3 = {0x00, 0x00, 0x00, 0x00};

    byte[] fileSetGUID = new byte[16];

    // I am not typing this one out.
    byte[] unknown4 = new byte[963];

    //???
    byte[] signature = new byte[5];

    int secondaryAdler32 = 0;

    protected VolumeSection(long currentOffset, Device disk, byte[] guid) {