Class: Android::Resource::Chunk
- Inherits:
-
Object
- Object
- Android::Resource::Chunk
show all
- Defined in:
- lib/android/resource.rb
Instance Method Summary
collapse
Constructor Details
#initialize(data, offset) ⇒ Chunk
Returns a new instance of Chunk.
10
11
12
13
14
|
# File 'lib/android/resource.rb', line 10
def initialize(data, offset)
@data = data
@offset = offset
exec_parse
end
|
Instance Method Details
#current_position ⇒ Object
30
31
32
|
# File 'lib/android/resource.rb', line 30
def current_position
@data_io.pos
end
|
#exec_parse ⇒ Object
15
16
17
18
19
20
|
# File 'lib/android/resource.rb', line 15
def exec_parse
@data_io = StringIO.new(@data, 'rb')
@data_io.seek(@offset)
parse
@data_io.close
end
|
#read_int16 ⇒ Object
24
25
26
|
# File 'lib/android/resource.rb', line 24
def read_int16
@data_io.read(2).unpack('v')[0]
end
|
#read_int32 ⇒ Object
21
22
23
|
# File 'lib/android/resource.rb', line 21
def read_int32
@data_io.read(4).unpack('V')[0]
end
|
#read_int8 ⇒ Object
27
28
29
|
# File 'lib/android/resource.rb', line 27
def read_int8
@data_io.read(1).ord
end
|