BitsBuffer class

A buffer of bits over a BytesBuffer.

Constructors

BitsBuffer([int initialCapacity = 32])
BitsBuffer.from(BytesBuffer bytes)
BitsBuffer.fromBytes(List<int> bytes)

Properties

bytesBuffer BytesBuffer
The internal BytesBuffer.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasUnflushedBits bool
Returns true if there are any remaining bits that haven't been written to the bytesBuffer.
no setter
length int
The length of the bytesBuffer.
no setter
position int
The position of the bytesBuffer.
no setter
remaining int
The remaining bytes of the bytesBuffer.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unflushedBitsLength int
Returns the length of unflushed bits in the internal bit buffer. See hasUnflushedBits.
no setter

Methods

checkUnflushedBits() → void
Checks for unflushed bits using hasUnflushedBits and throws a StateError if there are any bits that haven't been written.
isAtPadding({int? paddingPosition}) bool
If the current buffer is at the padding position, it consumes the padding bits and then returns true. If not, it simply returns false without changing the internal buffer's status or position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readBit() int
Reads a bit.
readBits(int bitsLength) int
Reads and returns the specified number of bits from the internal buffer.
readByte() int
Reads a byte.
readPadding() int
Reads the padding and returns the amount of bits read. If the current buffer is not at the padding position, it will return false without changing the internal buffer's status or position.
seek(int position) int
toBytes([int offset = 0, int? length]) Uint8List
Returns the internal bytesBuffer bytes. See BytesBuffer.toBytes.
toString() String
A string representation of this object.
override
writeBit(bool bit) int
Writes a bit (true: 1 ; false: 0). Returns the number of bits successfully written into the buffer.
writeBits(int bits, int bitsLength) int
Writes the specified number of bits from the given integer value into the internal bytesBuffer.
writeByte(int b) int
Writes a byte b.
writeBytes(List<int> bs) int
Writes a list of bytes.
writePadding() int
Writes padding bits to ensure proper byte alignment and returns the length of the written padding.

Operators

operator ==(Object other) bool
The equality operator.
inherited