class HexaPDF::Utils::BitStreamWriter

Parent

Helper class for writing out variable length integers one after another as bit stream.

This class allows one to write integers with a variable width of up to 16 bit to a bit stream using the write method. Every time when at least 16 bits are available, the write method returns those 16 bits as string and removes them from the internal cache.

Once all data has been written, the finalize method must be called to get the last remaining bits (again as a string).

Public Instance Methods

finalize()

Retrieves the final (zero padded) bits as a string.

write(int, bits)

Writes the integer int with a width of bits to the bit stream.

Returns a 16bit binary string if enough bits are available or an empty binary string otherwise.