A node.js library for bitwise binary encoding of data
var assert = ;var bitCoder = ;// 1000 bits to write to.var wbs = 1000;// Write out some values.wbs;wbs;wbs;// Pad and get the resultvar buf = wbs;// Get a new bitstream removing the paddingvar rbs = bitCoderBitStream;// Check the contents.assert;assert;assert;
Construct a new BitStream backed by a new
BitBuffer len bits.
Construct a new BitStream backed by an existing
Construct a new BitStream backed by an new
constructed from the existing buffer and optional length.
Construct a new
BitStream from of buffer previously obtained
wrap. This is a Function method, not a prototype method.
The current read/write pointer; change this to seek.
Pad a bit stream with 1 to 8 bits to the nearest byte boundary and return
the slice of the underling
Buffer that was written.
Read len bits (32 maximum) from the stream.
Write len (32 maximum) to the stream.
Write len bits with the lowest bit of v.
Write out the given value (v >= 1) in unary encoding
Read a unary encoded value from the stream
Write out the given value (v >= 1) in the indicated universal code
Read a value encoded with the indicated universal code
Write out the value v (0 <= v < n) in base n truncated binary representation
Read a base n truncated binary value from the stream
Construct a new BitBuffer len bits long backed by a
node.js or a
Uint8Array in the browser.
Construct a new BitBuffer backed by the supplied
The length is specified by the optional len, which is all the bits in
the buffer if unspecified.
Retreive len bits (32 maximum) from the buffer at the supplied offset.
Set len (32 maximum) to the buffer at the supplied offset.
Fill len bits with the lowest bit of v at the supplied offset.