Package com.github.stephenc.javaisotools.sabre.impl

Examples of com.github.stephenc.javaisotools.sabre.impl.ByteDataReference


    ByteArrayDataReference getStandardId() {
        return new ByteArrayDataReference(ISO9660Constants.STD_ID.getBytes());
    }

    ByteDataReference getVDVersion() {
        return new ByteDataReference(ISO9660Constants.VDV);
    }
View Full Code Here


    public HashMap doPVD() throws HandlerException {
        HashMap memory = doStandardVD();

        // Set Volume Flags to 0 (Unused Field)
        Fixup volumeFlags = (Fixup) memory.get("volumeFlagsFixup");
        volumeFlags.data(new ByteDataReference(0));
        volumeFlags.close();
        memory.remove("volumeFlagsFixup");

        // Set Escape Sequences to all 0 (Unused Field)
        Fixup escapeSequences = (Fixup) memory.get("escapeSequencesFixup");
View Full Code Here

        // Volume Descriptor Version
        streamHandler.data(getVDVersion());

        // Unused Field / Volume Flags (SVD): 1 byte
        Fixup vf = streamHandler.fixup(new ByteDataReference(0));
        memory.put("volumeFlagsFixup", vf);

        // System Identifier: 32 bytes
        streamHandler.data(getSystemId());

        // Volume Identifier: 32 bytes
        streamHandler.data(getVolumeId());

        // Unused Field: 8 bytes
        streamHandler.data(new EmptyByteArrayDataReference(8));

        // Volume Space Size
        Fixup vss = streamHandler.fixup(new BothWordDataReference(0));
        memory.put("volumeSpaceSizeFixup", vss);

        // Unused Field / Escape Sequences (SVD): 32 bytes
        Fixup es = streamHandler.fixup(new EmptyByteArrayDataReference(32));
        memory.put("escapeSequencesFixup", es);

        // Volume Set Size
        streamHandler.data(getVolumeSetSize());

        // Volume Sequence Number
        streamHandler.data(getVolumeSeqNo());

        // Logical Block Size
        streamHandler.data(getLogicalBlockSize());

        // Path Table Size
        Fixup pts = streamHandler.fixup(new BothWordDataReference(0));
        memory.put("ptSizeFixup", pts);

        // Type L Path Table Location
        Fixup tlpt = streamHandler.fixup(new LSBFWordDataReference(0));
        memory.put("typeLPTLocationFixup", tlpt);
        // Optional Type L Path Table Location: none
        streamHandler.data(new LSBFWordDataReference(0));

        // Type M Path Table Location
        Fixup tmpt = streamHandler.fixup(new WordDataReference(0));
        memory.put("typeMPTLocationFixup", tmpt);
        // Optional Type M Path Table Location: none
        streamHandler.data(new WordDataReference(0));

        // Directory Record for Root Directory: 34 bytes
        doRootDR(memory);

        // Volume Set Identifier: 128 bytes
        streamHandler.data(getVolumeSetId());

        // Publisher Identifier: 128 bytes
        streamHandler.data(getIdOrFile(publisher));
        // Data Preparer Identifier: 128 bytes
        streamHandler.data(getIdOrFile(dataPreparer));
        // Application Identifier: 128 bytes
        streamHandler.data(getIdOrFile(app));

        // Copyright File Identifier: 37 bytes
        streamHandler.data(getFile(copyrightFile));
        // Abstract File Identifier: 37 bytes
        streamHandler.data(getFile(abstractFile));
        // Bibliographic File Identifier: 37 bytes
        streamHandler.data(getFile(bibFile));

        // Volume Creation Date and Time: 17 bytes
        streamHandler.data(new ISO9660DateDataReference(createDate));
        // Volume Modification Date and Time: 17 bytes
        streamHandler.data(new ISO9660DateDataReference(modDate));
        // Volume Expiration Date and Time: 17 bytes
        streamHandler.data(new ISO9660DateDataReference(expireDate));
        // Volume Effective Date and Time: 17 bytes
        streamHandler.data(new ISO9660DateDataReference(effectiveDate));

        // File Structure Version
        streamHandler.data(getFileStructureVersion());

        // Reserved Field
        streamHandler.data(new ByteDataReference(0));

        // Application Use and reserved bytes: handle externally

        return memory;
    }
View Full Code Here

        HashMap drMemory = rddr.doDR();

        // Length of Directory Record
        Fixup drLengthFixup = (Fixup) drMemory.get("drLengthFixup");
        int drLength = ((Integer) drMemory.get("drLength")).intValue();
        drLengthFixup.data(new ByteDataReference(drLength));
        drLengthFixup.close();

        // Root Directory Location
        Fixup rootDirLocation = (Fixup) drMemory.get("drLocationFixup");
        memory.put("rootDirLocationFixup", rootDirLocation);
View Full Code Here

    private BothShortDataReference getLogicalBlockSize() {
        return new BothShortDataReference(ISO9660Constants.LOGICAL_BLOCK_SIZE);
    }

    private ByteDataReference getFileStructureVersion() {
        return new ByteDataReference(ISO9660Constants.FSV);
    }
View Full Code Here

        // Volume Descriptor Version
        streamHandler.data(getVDVersion());

        // Unused Field: 1 byte
        streamHandler.data(new ByteDataReference(0));

        // System Identifier: 32 bytes
        streamHandler.data(getSystemId());

        // Volume Partition Identifier: 32 bytes
View Full Code Here

            throws HandlerException {
        init(streamHandler, helper);

        if (object == ISO9660Constants.FI_ROOT) {
            // The root directory
            this.filenameDataReference = new ByteDataReference(0);
        } else if (object == ISO9660Constants.FI_DOT) {
            // "dot", i.e. the directory itself
            this.filenameDataReference = new ByteDataReference(0);
        } else if (object == ISO9660Constants.FI_DOTDOT) {
            // "dotdot", i.e. the parent directory
            this.filenameDataReference = new ByteDataReference(1);
        } else {
            throw new HandlerException("Unknown special directory type, neither ROOT nor DOT nor DOTDOT: " + object);
        }
    }
View Full Code Here

    public HashMap doDR() throws HandlerException {
        HashMap memory = new HashMap();
        int length = 0;

        // Length of Directory Record (including System Use Area)
        Fixup drLength = streamHandler.fixup(new ByteDataReference(0));
        memory.put("drLengthFixup", drLength);
        length += 1;

        // Extended Attribute Record Length
        Fixup extAttrRecordLengthFixup = streamHandler.fixup(new ByteDataReference(0));
        memory.put("drExtAttrRecordLengthFixup", extAttrRecordLengthFixup);
        length += 1;

        // Location of Extent
        Fixup locationFixup = streamHandler.fixup(new BothWordDataReference(0));
        memory.put("drLocationFixup", locationFixup);
        length += 8;

        // Data Length
        Fixup dataLengthFixup = streamHandler.fixup(new BothWordDataReference(0));
        memory.put("drDataLengthFixup", dataLengthFixup);
        length += 8;

        // Recording Date and Time
        Date now = new Date();
        ISO9660ShortDateDataReference date = new ISO9660ShortDateDataReference(now);
        streamHandler.data(date);
        length += date.getLength();

        // File Flags
        byte fileFlags = getFileFlags();
        streamHandler.data(new ByteDataReference(fileFlags));
        length += 1;

        // File Unit Size: 0 (no interleaving)
        streamHandler.data(new ByteDataReference(0));
        length += 1;

        // Interleave Gap Size: 0 (no interleaving)
        streamHandler.data(new ByteDataReference(0));
        length += 1;

        // Volume Sequence Number
        streamHandler.data(new BothShortDataReference(volSeqNo));
        length += 4;

        // Length of File Identifier
        streamHandler.data(new ByteDataReference(filenameDataReference.getLength()));
        length += 1;

        // File Identifier
        streamHandler.data(filenameDataReference);
        length += filenameDataReference.getLength();

        // Padding Field
        if (filenameDataReference.getLength() % 2 == 0) {
            streamHandler.data(new ByteDataReference(0));
            length += 1;
        }

        memory.put("drLength", new Integer(length));
View Full Code Here

        this.streamHandler = streamHandler;
        this.extAttrRecordLength = 0;

        if (object == ISO9660Constants.FI_ROOT || object == ISO9660Constants.FI_DOT) {
            // "root" or "dot", i.e. the directory itself
            this.filename = new ByteDataReference(0);
        } else if (object == ISO9660Constants.FI_DOTDOT) {
            // "dotdot", i.e. the parent directory
            this.filename = new ByteDataReference(1);
        } else {
            throw new HandlerException("Unknown special directory type, must be one of ROOT, DOT, DOTDOT: " + type);
        }

        setType(type);
View Full Code Here

        this.extAttrRecordLength = extAttrRecordLength;
    }

    public Fixup doPTR() throws HandlerException {
        // Length of Directory Identifier
        streamHandler.data(new ByteDataReference(filename.getLength()));

        // Extended Attribute Record Length
        streamHandler.data(new ByteDataReference(extAttrRecordLength));

        // Location of Extent
        DataReference location_dr = null;
        if (type.equals(ISO9660Constants.TYPE_L_PT)) {
            location_dr = new LSBFWordDataReference(0);
        } else if (type.equals(ISO9660Constants.TYPE_M_PT)) {
            location_dr = new WordDataReference(0);
        }
        Fixup locationFixup = streamHandler.fixup(location_dr);

        // Parent Directory Number
        DataReference parent_dn = null;
        if (type.equals(ISO9660Constants.TYPE_L_PT)) {
            parent_dn = new LSBFShortDataReference(parent);
        } else if (type.equals(ISO9660Constants.TYPE_M_PT)) {
            parent_dn = new ShortDataReference(parent);
        }
        streamHandler.data(parent_dn);

        // Directory Identifier
        streamHandler.data(filename);

        // Padding Field
        if (filename.getLength() % 2 == 1) {
            streamHandler.data(new ByteDataReference(0));
        }

        return locationFixup;
    }
View Full Code Here

TOP

Related Classes of com.github.stephenc.javaisotools.sabre.impl.ByteDataReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.