Class Origami::XRefStream
In: sources/parser/xreftable.rb
Parent: Stream

Class representing a XRef Stream.

Methods

<<   each   find   new  

Included Modules

Enumerable Configurable

Constants

XREF_FREE = 0
XREF_USED = 1
XREF_COMPRESSED = 2
W = [ 1, 2, 2 ]
Size = @xrefs.length + 1

Attributes

xrefs  [R] 

Public Class methods

[Source]

     # File sources/parser/xreftable.rb, line 284
284:     def initialize(data = "", dictionary = {})
285:       super(data, dictionary)
286: 
287:       @xrefs = nil
288:     end

Public Instance methods

Adds an XRef to this Stream.

[Source]

     # File sources/parser/xreftable.rb, line 302
302:     def <<(xref)
303:       load! if @xrefs.nil?
304: 
305:       @xrefs << xref  
306:     end

Iterates over each XRef present in the stream.

[Source]

     # File sources/parser/xreftable.rb, line 311
311:     def each(&b)
312:       load! if @xrefs.nil?
313: 
314:       @xrefs.each(&b)
315:     end

Returns an XRef matching this object number.

[Source]

     # File sources/parser/xreftable.rb, line 320
320:     def find(no)
321:       load! if @xrefs.nil?
322: 
323:       ranges = self.Index || [ 0, @xrefs.length ]
324: 
325:       index = 0
326:       (ranges.size / 2).times do |i|
327:         brange = ranges[i*2].to_i
328:         size = ranges[i*2+1].to_i
329:         return @xrefs[index + no - brange] if Range.new(brange, brange + size) === no
330: 
331:         index += size
332:       end
333: 
334:       nil
335:     end

[Validate]