Class: PDF::Reader::ObjectStream
- Inherits:
-
Object
- Object
- PDF::Reader::ObjectStream
- Defined in:
- lib/pdf/reader/object_stream.rb
Overview
provides a wrapper around a PDF stream object that contains other objects in it. This is done for added compression and is described as an “Object Stream” in the spec.
Instance Method Summary collapse
- #[](objid) ⇒ Object
-
#initialize(stream) ⇒ ObjectStream
constructor
:nodoc:.
- #size ⇒ Object
Constructor Details
#initialize(stream) ⇒ ObjectStream
:nodoc:
9 10 11 12 |
# File 'lib/pdf/reader/object_stream.rb', line 9 def initialize(stream) @dict = stream.hash @data = stream.unfiltered_data end |
Instance Method Details
#[](objid) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/pdf/reader/object_stream.rb', line 14 def [](objid) if offsets[objid].nil? nil else buf = PDF::Reader::Buffer.new(StringIO.new(@data), :seek => offsets[objid]) parser = PDF::Reader::Parser.new(buf) parser.parse_token end end |
#size ⇒ Object
24 25 26 |
# File 'lib/pdf/reader/object_stream.rb', line 24 def size @dict[:N] end |