class Android::Resource::Chunk

Public Class Methods

new(data, offset) click to toggle source
# File lib/android/resource.rb, line 10
def initialize(data, offset)
  data.force_encoding(Encoding::ASCII_8BIT)
  @data = data
  @offset = offset
  exec_parse
end

Public Instance Methods

current_position() click to toggle source
# File lib/android/resource.rb, line 31
def current_position
  @data_io.pos
end
exec_parse() click to toggle source
# File lib/android/resource.rb, line 16
def exec_parse
  @data_io = StringIO.new(@data, 'rb')
  @data_io.seek(@offset)
  parse
  @data_io.close
end
read_int16() click to toggle source
# File lib/android/resource.rb, line 25
def read_int16
  @data_io.read(2).unpack('v')[0]
end
read_int32() click to toggle source
# File lib/android/resource.rb, line 22
def read_int32
  @data_io.read(4).unpack('V')[0]
end
read_int8() click to toggle source
# File lib/android/resource.rb, line 28
def read_int8
  @data_io.read(1).ord
end