Class: Omnizip::Formats::Iso::VolumeDescriptor

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#application_identifierObject (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_dateObject (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

#identifierObject (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_sizeObject (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_dateObject (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_locationObject (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_sizeObject (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_identifierObject (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_identifierObject (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_recordObject (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_identifierObject (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

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 9

def type
  @type
end

#versionObject (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_identifierObject (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_numberObject (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_identifierObject (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_sizeObject (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_sizeObject (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

Parameters:

  • data (String)

    Binary sector data (2048 bytes)

Returns:



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

Parameters:

  • data (String)

    Binary 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

Returns:

  • (Boolean)

    true if primary VD



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

Returns:

  • (Boolean)

    true if terminator



67
68
69
# File 'lib/omnizip/formats/iso/volume_descriptor.rb', line 67

def terminator?
  @type == Iso::VD_TERMINATOR
end