class HexaPDF::FiberWithLength

is known beforehand. HexaPDF uses this information to avoid unnecessary memory usage.
This special Fiber class should be used when the total length of the data yielded by the fiber

def initialize(length, &block)

A +length+ of +nil+ is equal to -1.

Initializes the Fiber and sets the +length+.
def initialize(length, &block)
  super(&block)
  @length = length || -1
end