Package com.github.stephenc.javaisotools.udflib.structures

Examples of com.github.stephenc.javaisotools.udflib.structures.LogicalVolumeDescriptor


                                              int tagSerialNumber, long metadataFileLocation1,
                                              long metadataFileLocation2, int metadataAllocationUnitSize,
                                              int metadataAlignmentUnitSize, byte[] udfVersionIdentifierSuffix,
                                              int descriptorVersion, int filesetPartition, long filesetLocation)
            throws Exception {
        LogicalVolumeDescriptor myLogicalVolumeDescriptor = new LogicalVolumeDescriptor();

        myLogicalVolumeDescriptor.DescriptorTag.TagSerialNumber = tagSerialNumber;
        myLogicalVolumeDescriptor.DescriptorTag.DescriptorVersion = descriptorVersion;
        myLogicalVolumeDescriptor.DescriptorTag.TagLocation = targetBlock;

        myLogicalVolumeDescriptor.VolumeDescriptorSequenceNumber = volumeDescriptorSequenceNumber;
        myLogicalVolumeDescriptor.setLogicalVolumeIdentifier(imageIdentifier);
        myLogicalVolumeDescriptor.LogicalBlockSize = blockSize;

        myLogicalVolumeDescriptor.DomainIdentifier.setIdentifier("*OSTA UDF Compliant");
        myLogicalVolumeDescriptor.DomainIdentifier.IdentifierSuffix = udfVersionIdentifierSuffix;

        myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLength = blockSize;
        myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLocation.part_num = filesetPartition;
        myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLocation.lb_num = filesetLocation;

        myLogicalVolumeDescriptor.ImplementationIdentifier.setIdentifier(applicationIdentifier);
        myLogicalVolumeDescriptor.ImplementationIdentifier.IdentifierSuffix = applicationIdentifierSuffix;

        // partition map type 1, length 6, volume sequence number 0, partition number 0
        PartitionMapType1 myPartitionMapType1 = new PartitionMapType1();
        byte myPartitionMapType1Bytes[] = myPartitionMapType1.getBytes();

        if (metadataFileLocation1 > 0) {
            PartitionMapType2 myPartitionMapType2 = new PartitionMapType2();
            EntityID partitionTypeIdentifier = new EntityID();
            partitionTypeIdentifier.setIdentifier("*UDF Metadata Partition");
            partitionTypeIdentifier.IdentifierSuffix = udfVersionIdentifierSuffix;
            myPartitionMapType2.setupMetadataPartitionMap(partitionTypeIdentifier, 1, 0, metadataFileLocation1,
                    metadataFileLocation2, 0xFFFFFFFF, metadataAllocationUnitSize, metadataAlignmentUnitSize, (byte) 0);
            byte myPartitionMapType2Bytes[] = myPartitionMapType2.getBytes();

            myLogicalVolumeDescriptor.NumberofPartitionMaps = 2;
            myLogicalVolumeDescriptor.PartitionMaps =
                    new byte[myPartitionMapType1Bytes.length + myPartitionMapType2Bytes.length];

            System.arraycopy(myPartitionMapType1Bytes, 0, myLogicalVolumeDescriptor.PartitionMaps, 0,
                    myPartitionMapType1Bytes.length);
            System.arraycopy(myPartitionMapType2Bytes, 0, myLogicalVolumeDescriptor.PartitionMaps, 6,
                    myPartitionMapType2Bytes.length);
        } else {
            myLogicalVolumeDescriptor.NumberofPartitionMaps = 1;
            myLogicalVolumeDescriptor.PartitionMaps = myPartitionMapType1Bytes;
        }

        myLogicalVolumeDescriptor.MapTableLength = myLogicalVolumeDescriptor.PartitionMaps.length;

        myLogicalVolumeDescriptor.IntegritySequenceExtent.loc = LVIDSequenceStartingBlock;
        myLogicalVolumeDescriptor.IntegritySequenceExtent.len = LVIDSequenceLength;

        myRandomAccessFile.seek(targetBlock * blockSize);
        myLogicalVolumeDescriptor.write(myRandomAccessFile, blockSize);
    }
View Full Code Here


                catch (IOException myIOException) {
                }
            }
        }

        LogicalVolumeDescriptor myLogicalVolumeDescriptor = new LogicalVolumeDescriptor();

        try {

            myLogicalVolumeDescriptor.VolumeDescriptorSequenceNumber = volumeDescriptorSequenceNumber;
            myLogicalVolumeDescriptor.setLogicalVolumeIdentifier(imageIdentifier);
            myLogicalVolumeDescriptor.LogicalBlockSize = blockSize;

            myLogicalVolumeDescriptor.DomainIdentifier.setIdentifier("*OSTA UDF Compliant");
            myLogicalVolumeDescriptor.DomainIdentifier.IdentifierSuffix = udfVersionIdentifierSuffix;

            myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLength = blockSize;
            myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLocation.part_num = fileSetDescriptorPartition;
            myLogicalVolumeDescriptor.LogicalVolumeContentsUse.ExtentLocation.lb_num = fileSetDescriptorLocation;

            myLogicalVolumeDescriptor.ImplementationIdentifier.setIdentifier(applicationIdentifier);
            myLogicalVolumeDescriptor.ImplementationIdentifier.IdentifierSuffix = applicationIdentifierSuffix;

            // partition map type 1, length 6, volume sequence number 0, partition number 0
            PartitionMapType1 myPartitionMapType1 = new PartitionMapType1();
            byte myPartitionMapType1Bytes[] = myPartitionMapType1.getBytes();

            if (mainMetadataFileLocation > 0) {
                PartitionMapType2 myPartitionMapType2 = new PartitionMapType2();
                EntityID partitionTypeIdentifier = new EntityID();
                partitionTypeIdentifier.setIdentifier("*UDF Metadata Partition");
                partitionTypeIdentifier.IdentifierSuffix = udfVersionIdentifierSuffix;
                myPartitionMapType2.setupMetadataPartitionMap(partitionTypeIdentifier, 1, 0, mainMetadataFileLocation,
                        mirrorMetadataFileLocation, 0xFFFFFFFF, metadataAllocationUnitSize, metadataAlignmentUnitSize,
                        (byte) 0);
                byte myPartitionMapType2Bytes[] = myPartitionMapType2.getBytes();

                myLogicalVolumeDescriptor.NumberofPartitionMaps = 2;
                myLogicalVolumeDescriptor.PartitionMaps =
                        new byte[myPartitionMapType1Bytes.length + myPartitionMapType2Bytes.length];

                System.arraycopy(myPartitionMapType1Bytes, 0, myLogicalVolumeDescriptor.PartitionMaps, 0,
                        myPartitionMapType1Bytes.length);
                System.arraycopy(myPartitionMapType2Bytes, 0, myLogicalVolumeDescriptor.PartitionMaps, 6,
                        myPartitionMapType2Bytes.length);
            } else {
                myLogicalVolumeDescriptor.NumberofPartitionMaps = 1;
                myLogicalVolumeDescriptor.PartitionMaps = myPartitionMapType1Bytes;
            }
        }
        catch (Exception myException) {
            throw new HandlerException(myException);
        }

        myLogicalVolumeDescriptor.MapTableLength = myLogicalVolumeDescriptor.PartitionMaps.length;

        myLogicalVolumeDescriptor.IntegritySequenceExtent.loc = logicalVolumeIntegritySequenceStartingBlock;
        myLogicalVolumeDescriptor.IntegritySequenceExtent.len =
                (logicalVolumeIntegritySequenceEndingBlock - logicalVolumeIntegritySequenceStartingBlock) * blockSize;

        /*
          // full element with descriptor tag
          myLogicalVolumeDescriptor.DescriptorTag.TagSerialNumber = tagSerialNumber;
          myLogicalVolumeDescriptor.DescriptorTag.DescriptorVersion = descriptorVersion;
          myLogicalVolumeDescriptor.DescriptorTag.TagLocation = tagLocation;
          super.data( new ByteArrayDataReference( myLogicalVolumeDescriptor.getBytes( blockSize ) ) );
          */

        // without descriptor tag (handled in next pipeline section)
        super.startElement(new SabreUDFElement(SabreUDFElement.UDFElementType.DescriptorTag));
        super.data(new WordDataReference(6));                    // tag identifier
        super.data(new WordDataReference(tagLocation));            // tag location
        super.data(new WordDataReference(tagSerialNumber));        // tag serial number
        super.data(new WordDataReference(descriptorVersion));    // descriptor version
        super.data(new ByteArrayDataReference(myLogicalVolumeDescriptor.getBytesWithoutDescriptorTag()));
        super.endElement();
    }
View Full Code Here

TOP

Related Classes of com.github.stephenc.javaisotools.udflib.structures.LogicalVolumeDescriptor

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.