public class BitOutputStream extends Object implements AutoCloseable
Constructor and Description |
---|
BitOutputStream(OutputStream inner)
Instantiates a new Bit output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush()
Flush.
|
int |
getTotalBitsWritten()
Gets total bits written.
|
static Bits |
toBits(Consumer<BitOutputStream> fn)
To bits bits.
|
void |
write(Bits bits)
Write.
|
void |
write(boolean b)
Write.
|
void |
write(char value)
Write.
|
void |
write(double value)
Write.
|
<T extends Enum<T>> |
write(Enum<T> value)
Write.
|
void |
write(int value)
Write.
|
void |
write(short value)
Write.
|
Bits |
writeBoundedLong(long value,
long max)
Write bounded long bits.
|
void |
writeVarLong(long value)
Write var long.
|
void |
writeVarShort(short value)
Write var short.
|
void |
writeVarShort(short value,
int optimal)
Write var short.
|
public BitOutputStream(OutputStream inner)
inner
- the innerpublic static Bits toBits(Consumer<BitOutputStream> fn)
fn
- the fnpublic int getTotalBitsWritten()
public void flush() throws IOException
IOException
- the io exceptionpublic void write(Bits bits) throws IOException
bits
- the bitsIOException
- the io exceptionpublic void write(boolean b) throws IOException
b
- the bIOException
- the io exceptionpublic void write(double value) throws IOException
value
- the valueIOException
- the io exceptionpublic <T extends Enum<T>> void write(Enum<T> value) throws IOException
T
- the type parametervalue
- the valueIOException
- the io exceptionpublic void write(short value) throws IOException
value
- the valueIOException
- the io exceptionpublic void write(char value) throws IOException
value
- the valueIOException
- the io exceptionpublic void write(int value) throws IOException
value
- the valueIOException
- the io exceptionpublic Bits writeBoundedLong(long value, long max) throws IOException
value
- the valuemax
- the maxIOException
- the io exceptionpublic void writeVarLong(long value) throws IOException
value
- the valueIOException
- the io exceptionpublic void writeVarShort(short value) throws IOException
value
- the valueIOException
- the io exceptionpublic void writeVarShort(short value, int optimal) throws IOException
value
- the valueoptimal
- the optimalIOException
- the io exceptionpublic void close() throws IOException
close
in interface AutoCloseable
IOException
Copyright © 2019 SimiaCryptus Software. All rights reserved.