Class: Android::Resource::ResStringPool
- Inherits:
-
ChunkHeader
- Object
- Chunk
- ChunkHeader
- Android::Resource::ResStringPool
- Defined in:
- lib/android/resource.rb
Defined Under Namespace
Classes: UnsupportedStringFormatError
Constant Summary collapse
- SORTED_FLAG =
1 << 0
- UTF8_FLAG =
1 << 8
Instance Attribute Summary collapse
-
#strings ⇒ Object
readonly
Returns the value of attribute strings.
Attributes inherited from ChunkHeader
Instance Method Summary collapse
Methods inherited from Chunk
#current_position, #exec_parse, #initialize, #read_int16, #read_int32, #read_int8
Constructor Details
This class inherits a constructor from Android::Resource::Chunk
Instance Attribute Details
#strings ⇒ Object (readonly)
Returns the value of attribute strings.
62 63 64 |
# File 'lib/android/resource.rb', line 62 def strings @strings end |
Instance Method Details
#add_string(str) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/android/resource.rb', line 64 def add_string(str) raise UnsupportedStringFormatError, 'Adding strings in UTF-8 format is not supported yet' if utf8_string_format? @data_io = StringIO.new(@data, 'r+b') increment_string_count bytes_added = insert_string(str) increment_string_start_offset update_chunk_size(bytes_added) @data_io.close [@string_count - 1, bytes_added] end |
#utf8_string_format? ⇒ Boolean
78 79 80 |
# File 'lib/android/resource.rb', line 78 def utf8_string_format? (@flags & UTF8_FLAG != 0) end |