Methods Summary |
---|
public void | flush()
for (int i = curBit; i < 8; i++) {
curByte[i] = 0;
}
curBit = 0;
writeCurByte();
|
public void | write1Bit(int value)
Debug.print(value);
if (curBit == 8) {
curBit = 0;
writeCurByte();
}
curByte[curBit++] = value;
|
public void | writeByte(int b)
os.write(b);
|
private void | writeCurByte()
int toWrite = (curByte[0] << 7) | (curByte[1] << 6) | (curByte[2] << 5)
| (curByte[3] << 4) | (curByte[4] << 3) | (curByte[5] << 2)
| (curByte[6] << 1) | curByte[7];
os.write(toWrite);
|
public void | writeNBit(long value, int n)
for (int i = 0; i < n; i++) {
write1Bit((int) (value >> (n - i - 1)) & 0x1);
}
|
public void | writeRemainingZero()
writeNBit(0, 8 - curBit);
|