Class: Omnizip::Formats::Iso::VolumeDescriptor
- Inherits:
-
Object
- Object
- Omnizip::Formats::Iso::VolumeDescriptor
- Defined in:
- lib/omnizip/formats/iso/volume_descriptor.rb
Overview
ISO 9660 Volume Descriptor Represents the primary volume descriptor containing metadata
Constant Summary collapse
- ISO_IDENTIFIER =
Standard identifier for ISO 9660
"CD001"
Instance Attribute Summary collapse
-
#application_identifier ⇒ Object
readonly
Returns the value of attribute application_identifier.
-
#creation_date ⇒ Object
readonly
Returns the value of attribute creation_date.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#logical_block_size ⇒ Object
readonly
Returns the value of attribute logical_block_size.
-
#modification_date ⇒ Object
readonly
Returns the value of attribute modification_date.
-
#path_table_location ⇒ Object
readonly
Returns the value of attribute path_table_location.
-
#path_table_size ⇒ Object
readonly
Returns the value of attribute path_table_size.
-
#preparer_identifier ⇒ Object
readonly
Returns the value of attribute preparer_identifier.
-
#publisher_identifier ⇒ Object
readonly
Returns the value of attribute publisher_identifier.
-
#root_directory_record ⇒ Object
readonly
Returns the value of attribute root_directory_record.
-
#system_identifier ⇒ Object
readonly
Returns the value of attribute system_identifier.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#volume_identifier ⇒ Object
readonly
Returns the value of attribute volume_identifier.
-
#volume_sequence_number ⇒ Object
readonly
Returns the value of attribute volume_sequence_number.
-
#volume_set_identifier ⇒ Object
readonly
Returns the value of attribute volume_set_identifier.
-
#volume_set_size ⇒ Object
readonly
Returns the value of attribute volume_set_size.
-
#volume_space_size ⇒ Object
readonly
Returns the value of attribute volume_space_size.
Class Method Summary collapse
-
.parse(data) ⇒ VolumeDescriptor
Parse volume descriptor from binary data.
Instance Method Summary collapse
-
#parse(data) ⇒ Object
Parse descriptor data.
-
#primary? ⇒ Boolean
Check if this is a primary volume descriptor.
-
#terminator? ⇒ Boolean
Check if this is a terminator.
Instance Attribute Details
#application_identifier ⇒ Object (readonly)
Returns the value of attribute application_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def application_identifier @application_identifier end |
#creation_date ⇒ Object (readonly)
Returns the value of attribute creation_date.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def creation_date @creation_date end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def identifier @identifier end |
#logical_block_size ⇒ Object (readonly)
Returns the value of attribute logical_block_size.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def logical_block_size @logical_block_size end |
#modification_date ⇒ Object (readonly)
Returns the value of attribute modification_date.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def modification_date @modification_date end |
#path_table_location ⇒ Object (readonly)
Returns the value of attribute path_table_location.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def path_table_location @path_table_location end |
#path_table_size ⇒ Object (readonly)
Returns the value of attribute path_table_size.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def path_table_size @path_table_size end |
#preparer_identifier ⇒ Object (readonly)
Returns the value of attribute preparer_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def preparer_identifier @preparer_identifier end |
#publisher_identifier ⇒ Object (readonly)
Returns the value of attribute publisher_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def publisher_identifier @publisher_identifier end |
#root_directory_record ⇒ Object (readonly)
Returns the value of attribute root_directory_record.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def root_directory_record @root_directory_record end |
#system_identifier ⇒ Object (readonly)
Returns the value of attribute system_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def system_identifier @system_identifier end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def version @version end |
#volume_identifier ⇒ Object (readonly)
Returns the value of attribute volume_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def volume_identifier @volume_identifier end |
#volume_sequence_number ⇒ Object (readonly)
Returns the value of attribute volume_sequence_number.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def volume_sequence_number @volume_sequence_number end |
#volume_set_identifier ⇒ Object (readonly)
Returns the value of attribute volume_set_identifier.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def volume_set_identifier @volume_set_identifier end |
#volume_set_size ⇒ Object (readonly)
Returns the value of attribute volume_set_size.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def volume_set_size @volume_set_size end |
#volume_space_size ⇒ Object (readonly)
Returns the value of attribute volume_space_size.
9 10 11 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9 def volume_space_size @volume_space_size end |
Class Method Details
.parse(data) ⇒ VolumeDescriptor
Parse volume descriptor from binary data
24 25 26 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 24 def self.parse(data) new.tap { |vd| vd.parse(data) } end |
Instance Method Details
#parse(data) ⇒ Object
Parse descriptor data
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 31 def parse(data) raise "Invalid volume descriptor size" unless data.bytesize >= 2048 # Byte 0: Volume descriptor type @type = data.getbyte(0) # Bytes 1-5: Standard identifier "CD001" @identifier = data[1, 5] unless @identifier == ISO_IDENTIFIER raise "Invalid ISO identifier: expected #{ISO_IDENTIFIER}, got #{@identifier}" end # Byte 6: Version (should be 1) @version = data.getbyte(6) # Parse based on type case @type when Iso::VD_PRIMARY parse_primary_volume_descriptor(data) when Iso::VD_TERMINATOR # Terminator has no additional data else # Skip other types for now end end |
#primary? ⇒ Boolean
Check if this is a primary volume descriptor
60 61 62 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 60 def primary? @type == Iso::VD_PRIMARY end |
#terminator? ⇒ Boolean
Check if this is a terminator
67 68 69 |
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 67 def terminator? @type == Iso::VD_TERMINATOR end |