|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream jwo.utils.gifutils.BitOutputStream
public class BitOutputStream
Allows the writing of 1 to 32 bits at a time, on any bit boundary. Bits are written to bytes, least significant bit first.
Field Summary | |
---|---|
protected int |
cachedBits
Stores any cached bits which need to be written to the underlying stream. |
protected int |
numCachedBits
Stores the number of valid bits in 'cachedBits' and is never more than 7. |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
BitOutputStream(OutputStream os)
Creates a bit output stream based on the given underlying output stream. |
Method Summary | |
---|---|
void |
flush()
Flushes any cached bits and bytes. |
void |
write(int byteValue)
Writes a byte at the current bit boundary. |
void |
writeBit(int bit)
Writes a single bit (1 or 0) to the underlying output stream. |
void |
writeBits(int value,
int numBits)
Writes the given number of bits (1 to 32) from the given value to the underlying output stream. |
Methods inherited from class java.io.FilterOutputStream |
---|
close, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int cachedBits
protected int numCachedBits
Constructor Detail |
---|
public BitOutputStream(OutputStream os)
os
- Output stream to use.Method Detail |
---|
public void write(int byteValue) throws IOException
write
in class FilterOutputStream
byteValue
- Value to write to output stream.
IOException
- if problem writing to output stream.public void writeBits(int value, int numBits) throws IOException
value
- Value to write to output stream.numBits
- Number of bits to write.
IllegalArgumentException
- if numBits is not between 1 and 32.
IOException
- if problem writing to output stream.public void writeBit(int bit) throws IOException
bit
- Bit to write.
IOException
- if problem writing to output stream.public void flush() throws IOException
flush
in interface Flushable
flush
in class FilterOutputStream
IOException
- if problem flushing output stream.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |