Class: Origami::XRefToCompressedObj

Inherits:
Object
  • Object
show all
Defined in:
lib/origami/xreftable.rb

Overview

An xref poiting to an Object embedded in an ObjectStream.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(objstmno, index) ⇒ XRefToCompressedObj

Returns a new instance of XRefToCompressedObj.



280
281
282
283
# File 'lib/origami/xreftable.rb', line 280

def initialize(objstmno, index)
  @objstmno = objstmno
  @index = index
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



278
279
280
# File 'lib/origami/xreftable.rb', line 278

def index
  @index
end

#objstmnoObject

Returns the value of attribute objstmno.



278
279
280
# File 'lib/origami/xreftable.rb', line 278

def objstmno
  @objstmno
end

Instance Method Details

#to_xrefstm_data(type_w, field1_w, field2_w) ⇒ Object



285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/origami/xreftable.rb', line 285

def to_xrefstm_data(type_w, field1_w, field2_w)

  type_w <<= 3
  field1_w <<= 3
  field2_w <<= 3

  type = "\002".unpack("B#{type_w}")[0]
  objstmno = @objstmno.to_s(2)
  objstmno = '0' * (field1_w - objstmno.size) + objstmno
  index = @index.to_s(2)
  index = '0' * (field2_w - index.size) + index

  [ type , objstmno, index ].pack("B#{type_w}B#{field1_w}B#{field2_w}")
end