|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.helsinki.cs.ohtu.mpeg2.util.BitOutputStream
public class BitOutputStream
This class implements single bit writing capabilities on top of standard OutputStreams.
Nested Class Summary | |
---|---|
static class |
BitOutputStream.BitOrder
This enum specifies the bit order used. |
Field Summary | |
---|---|
private int |
bitLocation
|
private int |
bitNumber
|
private boolean |
closed
|
private byte |
currentByte
|
private BitOutputStream.BitOrder |
order
|
private java.io.OutputStream |
os
|
Constructor Summary | |
---|---|
BitOutputStream(java.io.OutputStream os,
BitOutputStream.BitOrder order)
Creates a new BitOutputStream that writes to the given OutputStream. |
Method Summary | |
---|---|
void |
byteAlign()
Aligns the stream to the next byte border. |
void |
close()
Closes the stream. |
void |
flush()
Flushes the stream. |
void |
writeBit(int bitToWrite)
Writes one bit to the stream. |
void |
writeBits(int[] bits)
Writes multiple bits to the stream. |
void |
writeByte(byte byteToWrite)
Writes a whole byte to the stream. |
void |
writeLowBits(long value,
int bitCount)
Writes a given number of low-order bits from the given integer to the stream. |
void |
writeRangeBits(long value,
int oneHigherBit,
int lowBit)
Writes a range of bits from the given integer to the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.OutputStream os
private BitOutputStream.BitOrder order
private int bitLocation
private int bitNumber
private byte currentByte
private boolean closed
Constructor Detail |
---|
public BitOutputStream(java.io.OutputStream os, BitOutputStream.BitOrder order)
os
- The OutputStream to write to.order
- The BitOrder to use.Method Detail |
---|
public void writeBit(int bitToWrite) throws java.io.IOException
bitToWrite
- The bit to write: 0 or 1.
java.io.IOException
public void writeBits(int[] bits) throws java.io.IOException
bits
- The bits to write: each either 0 or 1.
java.io.IOException
public void writeLowBits(long value, int bitCount) throws java.io.IOException
value
- Integer to extract the bits to write from.bitCount
- How many bits to write.
java.io.IOException
public void writeRangeBits(long value, int oneHigherBit, int lowBit) throws java.io.IOException
value
- Integer to extract the bits to write from.oneHigherBit
- Number of the bit just left of the range desired to be written.lowBit
- Number of the rightmost bit in the range to be written.
java.io.IOException
public void writeByte(byte byteToWrite) throws java.io.IOException
byteToWrite
- The byte to write.
java.io.IOException
public void byteAlign() throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |