Class: HexaPDF::Type::ObjectStream::Data
- Inherits:
-
Object
- Object
- HexaPDF::Type::ObjectStream::Data
- Defined in:
- lib/hexapdf/type/object_stream.rb
Overview
Holds all necessary information to load objects for an object stream.
Instance Method Summary collapse
-
#initialize(stream_data, oids, offsets) ⇒ Data
constructor
Initializes the data object with the needed values.
-
#object_by_index(index) ⇒ Object
Returns the object specified by the given index together with its object number.
Constructor Details
Instance Method Details
#object_by_index(index) ⇒ Object
Returns the object specified by the given index together with its object number.
Objects are not pre-loaded, so every time this method is invoked the associated stream data is parsed and a new object returned.
90 91 92 93 94 95 96 97 |
# File 'lib/hexapdf/type/object_stream.rb', line 90 def object_by_index(index) if index >= @offsets.size || index < 0 raise ArgumentError, "Invalid index into object stream given" end @tokenizer.pos = @offsets[index] [@tokenizer.next_object, @oids[index]] end |