BitSequence class
A sequence of bits, encoded in a byte array.
Each byte in the bitmap
byte array stores 8 bits of the sequence. The only
exception is the last byte, which may store 8 or fewer bits. The padding
defines the number of bits of the last byte to be ignored as "padding". The
values of these "padding" bits are unspecified and must be ignored. To
retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0
. To
retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0
. To
retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0
. To
retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0
. To
retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0
. The
"size" of a BitSequence
(the number of bits it contains) is calculated by
this formula: (bitmap.length * 8) - padding
.
Constructors
- BitSequence({String? bitmap, int? padding})
- BitSequence.fromJson(Map json_)
Properties
- bitmap ↔ String?
-
The bytes that encode the bit sequence.
getter/setter pair
-
bitmapAsBytes
↔ List<
int> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- padding ↔ int?
-
The number of bits of the last byte in
bitmap
to ignore as "padding".getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited