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

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


    private void writePrimaryVolumeDescriptor(RandomAccessFile myRandomAccessFile, long volumeDescriptorSequenceNumber,
                                              long targetBlock, Calendar recordingTimeCalendar, int tagSerialNumber,
                                              int descriptorVersion)
            throws Exception {
        PrimaryVolumeDescriptor myPrimaryVolumeDescriptor = new PrimaryVolumeDescriptor();

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

        myPrimaryVolumeDescriptor.VolumeDescriptorSequenceNumber = volumeDescriptorSequenceNumber;
        myPrimaryVolumeDescriptor.PrimaryVolumeDescriptorNumber = 0;
        myPrimaryVolumeDescriptor.setVolumeIdentifier(imageIdentifier);
        myPrimaryVolumeDescriptor.VolumeSequenceNumber = 1;
        myPrimaryVolumeDescriptor.MaximumVolumeSequenceNumber = 1;
        myPrimaryVolumeDescriptor.InterchangeLevel = 2;
        myPrimaryVolumeDescriptor.MaximumInterchangeLevel = 3;
        myPrimaryVolumeDescriptor.CharacterSetList = 1;
        myPrimaryVolumeDescriptor.MaximumCharacterSetList = 1;

        String volumeSetIdentifier = Long.toHexString(recordingTimeCalendar.getTimeInMillis()) + " " + imageIdentifier;
        myPrimaryVolumeDescriptor.setVolumeSetIdentifier(volumeSetIdentifier);

        myPrimaryVolumeDescriptor.ApplicationIdentifier.setIdentifier(applicationIdentifier);
        myPrimaryVolumeDescriptor.ApplicationIdentifier.IdentifierSuffix = applicationIdentifierSuffix;

        myPrimaryVolumeDescriptor.RecordingDateandTime.set(recordingTimeCalendar);

        myPrimaryVolumeDescriptor.ImplementationIdentifier.setIdentifier(applicationIdentifier);

        myPrimaryVolumeDescriptor.PredecessorVolumeDescriptorSequenceLocation = 0;
        myPrimaryVolumeDescriptor.Flags = 1;

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


                catch (IOException myIOException) {
                }
            }
        }

        PrimaryVolumeDescriptor myPrimaryVolumeDescriptor = new PrimaryVolumeDescriptor();

        myPrimaryVolumeDescriptor.VolumeDescriptorSequenceNumber = volumeDescriptorSequenceNumber;
        myPrimaryVolumeDescriptor.PrimaryVolumeDescriptorNumber = 0;
        myPrimaryVolumeDescriptor.VolumeSequenceNumber = 1;
        myPrimaryVolumeDescriptor.MaximumVolumeSequenceNumber = 1;
        myPrimaryVolumeDescriptor.InterchangeLevel = 2;
        myPrimaryVolumeDescriptor.MaximumInterchangeLevel = 3;
        myPrimaryVolumeDescriptor.CharacterSetList = 1;
        myPrimaryVolumeDescriptor.MaximumCharacterSetList = 1;

        String volumeSetIdentifier = Long.toHexString(recordingTimeCalendar.getTimeInMillis()) + " " + imageIdentifier;

        try {
            myPrimaryVolumeDescriptor.setVolumeIdentifier(imageIdentifier);
            myPrimaryVolumeDescriptor.setVolumeSetIdentifier(volumeSetIdentifier);
            myPrimaryVolumeDescriptor.ApplicationIdentifier.setIdentifier(applicationIdentifier);
            myPrimaryVolumeDescriptor.ImplementationIdentifier.setIdentifier(applicationIdentifier);
        }
        catch (Exception myException) {
            throw new HandlerException(myException);
        }

        myPrimaryVolumeDescriptor.ApplicationIdentifier.IdentifierSuffix = applicationIdentifierSuffix;

        myPrimaryVolumeDescriptor.RecordingDateandTime.set(recordingTimeCalendar);

        myPrimaryVolumeDescriptor.PredecessorVolumeDescriptorSequenceLocation = 0;
        myPrimaryVolumeDescriptor.Flags = 1;

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

        // without descriptor tag (handled in next pipeline section)
        super.startElement(new SabreUDFElement(SabreUDFElement.UDFElementType.DescriptorTag));
        super.data(new WordDataReference(1));                    // 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(myPrimaryVolumeDescriptor.getBytesWithoutDescriptorTag()));
        super.endElement();
    }
View Full Code Here

TOP

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

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.