Documentation
¶
Overview ¶
Implements LSb-First reader and writer for reading/writing arbitrary bit width integers from/to normal go byte streams. An example use case is Vorbis coding. Note that this implementation is completely unoptimized. The Writer needs to cache the byte it is about write, so FlushByte() must be called to ensure the stream is re-aligned to 8bits and all data is written.
Index ¶
- type Reader
- type Writer
- func (w *Writer) BitsWritten() int
- func (w *Writer) FlushByte() error
- func (w *Writer) IsAligned() bool
- func (w *Writer) Write(p []byte) (n int, err error)
- func (w *Writer) WriteBit(b bool) error
- func (w *Writer) WriteBits(b uint64, nb uint8) (n int, err error)
- func (w *Writer) WriteBitsMany(args ...uint64) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
Reads individual bits. Bit order: LSb-First
func (*Reader) IsAligned ¶
Returns true if the reader is currently 8-bit aligned (and thus is in sync with the underlying reader)
type Writer ¶
Writes individual bits. Bit order: LSb-First
func (*Writer) BitsWritten ¶
func (*Writer) IsAligned ¶
Returns true if the writer is currently 8-bit aligned (and thus flushing will do nothing).