Documentation
¶
Overview ¶
Package bitstream is a simple wrapper around a io.Reader and io.Writer to provide bit-level access to the stream. This code was borrowed and adapted from from https://github.com/dgryski/go-bitstream
Index ¶
- type Bit
- type BitReader
- type BitWriter
- func (b *BitWriter) Flush(bit Bit) error
- func (b *BitWriter) Pending() (byt byte, vals uint8)
- func (b *BitWriter) Reset(w io.Writer)
- func (b *BitWriter) Resume(data byte, count uint8)
- func (b *BitWriter) WriteBit(bit Bit) error
- func (b *BitWriter) WriteBits(u uint64, nbits int) error
- func (b *BitWriter) WriteByte(byt byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitReader ¶
type BitReader struct {
// contains filtered or unexported fields
}
A BitReader reads bits from an io.Reader
func (*BitReader) ReadBit ¶
ReadBit returns the next bit from the stream, reading a new byte from the underlying reader if required.
type BitWriter ¶
type BitWriter struct {
// contains filtered or unexported fields
}
A BitWriter writes bits to an io.Writer
func NewWriter ¶
NewWriter returns a BitWriter that buffers bits and write the resulting bytes to 'w'
func (*BitWriter) Reset ¶
Reset replaces the underlying io.Writer with the provided writer and resets all internal state to its initial value allowing for reuse of the BitWriter without additional allocations
func (*BitWriter) WriteBit ¶
WriteBit writes a single bit to the stream, writing a new byte to 'w' if required.