The implementation stores single bits as a word in the buffer. If a bit is set, the corresponding word in the buffer will be non-zero. If a bit is clear, the corresponding word is zero. Although this may seem waseful, this can be a factor of two quicker than packing 8 bits to a byte and extracting.
| Modifier and Type | Field and Description |
|---|---|
| private final int[] | |
| private int | |
| private static final int | BUFSIZE
Size of the internal buffer to store the reserved bits. |
| private static final int | BUFSIZE_MASK
Mask that can be used to quickly implement the modulus operation on BUFSIZE. |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | |
| public void | |
| public int | |
| public void | |
| public void |
| buf | back to summary |
|---|---|
| private final int[] buf | |
| buf_byte_idx | back to summary |
|---|---|
| private int buf_byte_idx | |
| BUFSIZE | back to summary |
|---|---|
| private static final int BUFSIZE Size of the internal buffer to store the reserved bits. Must be a power of 2. And x8, as each bit is stored as a single entry. | |
| BUFSIZE_MASK | back to summary |
|---|---|
| private static final int BUFSIZE_MASK Mask that can be used to quickly implement the modulus operation on BUFSIZE. | |
| offset | back to summary |
|---|---|
| private int offset | |
| totbit | back to summary |
|---|---|
| private int totbit | |
| BitReserve | back to summary |
|---|---|
| pack-priv BitReserve() | |
| hget1bit | back to summary |
|---|---|
| public int hget1bit() Returns next bit from reserve.
| |
| hgetbits | back to summary |
|---|---|
| public int hgetbits(int N) Read a number bits from the bit stream.
| |
| hputbuf | back to summary |
|---|---|
| public void hputbuf(int val) Write 8 bits into the bit stream. | |
| hsstell | back to summary |
|---|---|
| public int hsstell() Return totbit Field. | |
| rewindNbits | back to summary |
|---|---|
| public void rewindNbits(int N) Rewind N bits in Stream. | |
| rewindNbytes | back to summary |
|---|---|
| public void rewindNbytes(int N) Rewind N bytes in Stream. | |