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, writeSingleByte
flush, write
public BitOutputStream(OutputStream out)
out
- stream to write topublic void finish() throws IOException
FinishableOutputStream
finish
in interface FinishableOutputStream
finish
in class CompressableOutputStream
IOException
- if write failspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class CompressableOutputStream
IOException
protected 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.