public class BitOutputStream extends CompressableOutputStream implements FinishableOutputStream
out| Constructor and Description |
|---|
BitOutputStream(OutputStream out)
Create a Bit output stream from given stream
|
| Modifier and Type | Method and Description |
|---|---|
void |
byteAlign()
A utility to force the next write to be byte-aligned.
|
void |
close() |
void |
finish()
Finishes the current outputstream (compresses, flushes, caluclates CRC)
and writes whatever is left in the buffers, but does not close the
stream.
|
protected void |
flushByte()
A utility method to flush the next byte
|
static int |
minBits(float number)
calculates the minumum number of bits necessary to write number.
|
static int |
minBits(long number) |
static int |
minBits(long number,
boolean signed) |
void |
writeBitFlag(boolean bit)
Write a bit to the output stream.
|
void |
writeFBits(float value,
int n)
Write a float value of n-bits to the stream.
|
void |
writeSBits(long value,
int n)
Write a signed value of n-bits to the output stream.
|
void |
writeUBits(long value,
int n)
Write an unsigned value of n-bits to the output stream.
|
startCompressing, write, write, writeByteArray, writeSingleByteflush, writepublic BitOutputStream(OutputStream out)
out - stream to write topublic void finish()
throws IOException
FinishableOutputStreamfinish in interface FinishableOutputStreamfinish in class CompressableOutputStreamIOException - if write failspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class CompressableOutputStreamIOExceptionprotected void flushByte()
throws IOException
IOException - if write failspublic void byteAlign()
throws IOException
IOException - if write failspublic void writeBitFlag(boolean bit)
throws IOException
bit - value to writeIOException - if write failspublic void writeSBits(long value,
int n)
throws IOException
value - value to writen - number of bits to writeIOException - if write failspublic void writeFBits(float value,
int n)
throws IOException
value - value to writen - number of bits to writeIOException - if write failspublic void writeUBits(long value,
int n)
throws IOException
value - value to writen - number of bits to writeIOException - if write failspublic static int minBits(float number)
number - numberpublic static int minBits(long number)
number - value to calculate bits forpublic static int minBits(long number,
boolean signed)
number - value to calculate bits forsigned - true if the value if signed (< 0)Copyright © 2016. All rights reserved.