Class: PAKFile::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/pakspy.rb

Overview

Reperesents PAK header block

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header) ⇒ Header

Unpacks the 12 header bytes from entry



161
162
163
164
165
166
167
168
169
170
# File 'lib/pakspy.rb', line 161

def initialize(header)
  # magic  - 4 byte arbitary string (not null terminated)
  # offset - 4 byte integer (little endian)
  # size   - 4 byte integer (little endian)
  data = header.unpack "a4VV"

  @magic  = data[0]
  @offset = data[1]
  @size   = data[2]
end

Instance Attribute Details

#magicObject

Returns the value of attribute magic.



157
158
159
# File 'lib/pakspy.rb', line 157

def magic
  @magic
end

#offsetObject

Returns the value of attribute offset.



157
158
159
# File 'lib/pakspy.rb', line 157

def offset
  @offset
end

#sizeObject

Returns the value of attribute size.



157
158
159
# File 'lib/pakspy.rb', line 157

def size
  @size
end