Class: Omnizip::Formats::Iso::RockRidge::SUEntry
- Inherits:
-
Object
- Object
- Omnizip::Formats::Iso::RockRidge::SUEntry
- Defined in:
- lib/omnizip/formats/iso/rock_ridge.rb
Overview
System Use Entry
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#length ⇒ Object
Returns the value of attribute length.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
.parse(data, offset = 0) ⇒ SUEntry
Parse from binary.
Instance Method Summary collapse
-
#initialize(signature, version: 1, data: "") ⇒ SUEntry
constructor
Initialize entry.
-
#to_binary ⇒ String
Convert to binary.
Constructor Details
#initialize(signature, version: 1, data: "") ⇒ SUEntry
Initialize entry
38 39 40 41 42 43 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 38 def initialize(signature, version: 1, data: "") @signature = signature @length = 4 + data.bytesize @version = version @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
31 32 33 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 31 def data @data end |
#length ⇒ Object
Returns the value of attribute length.
31 32 33 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 31 def length @length end |
#signature ⇒ Object
Returns the value of attribute signature.
31 32 33 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 31 def signature @signature end |
#version ⇒ Object
Returns the value of attribute version.
31 32 33 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 31 def version @version end |
Class Method Details
.parse(data, offset = 0) ⇒ SUEntry
Parse from binary
62 63 64 65 66 67 68 69 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 62 def self.parse(data, offset = 0) signature = data[offset, 2] length = data.getbyte(offset + 2) version = data.getbyte(offset + 3) entry_data = data[offset + 4, length - 4] new(signature, version: version, data: entry_data) end |
Instance Method Details
#to_binary ⇒ String
Convert to binary
48 49 50 51 52 53 54 55 |
# File 'lib/omnizip/formats/iso/rock_ridge.rb', line 48 def to_binary result = +"" result << @signature # 2 bytes result << [@length].pack("C") # 1 byte result << [@version].pack("C") # 1 byte result << @data result end |