Class BitArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.imaging.common.itu_t4.BitArrayOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
class BitArrayOutputStream extends java.io.OutputStream
Output stream writing to a byte array, and capable of writing 1 bit at a time, starting from the most significant bit.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
buffer
private int
bytesWritten
private int
cache
private int
cacheMask
-
Constructor Summary
Constructors Constructor Description BitArrayOutputStream()
BitArrayOutputStream(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
int
getBitsAvailableInCurrentByte()
int
size()
byte[]
toByteArray()
void
write(int b)
void
writeBit(int bit)
private void
writeByte(int b)
-
-
-
Method Detail
-
size
public int size()
-
toByteArray
public byte[] toByteArray()
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
-
flush
public void flush()
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
-
write
public void write(int b)
- Specified by:
write
in classjava.io.OutputStream
-
writeBit
public void writeBit(int bit)
-
getBitsAvailableInCurrentByte
public int getBitsAvailableInCurrentByte()
-
writeByte
private void writeByte(int b)
-
-