Package htsjdk.samtools.cram.io
Interface BitOutputStream
- All Superinterfaces:
AutoCloseable,Closeable,Flushable
- All Known Implementing Classes:
DefaultBitOutputStream
An interface to describe the requirements for writing out bits as opposed to bytes. Implementors must keep track of the amount of data
written similar to
OutputStream concept and provide flush/close functionality accordingly.-
Method Summary
Modifier and TypeMethodDescriptionvoidwrite(boolean bit) Write a single bit specified in the boolean argument.voidwrite(boolean bit, long repeat) Write a single bit specified in the boolean argument repeatedly.voidwrite(byte bitContainer, int nofBits) Write specified number of bits supplied in the byte value.voidwrite(int bitContainer, int nofBits) Write specified number of bits supplied in the integer value.voidwrite(long bitContainer, int nofBits) Write specified number of bits supplied in the long value.
-
Method Details
-
write
void write(int bitContainer, int nofBits) Write specified number of bits supplied in the integer value. The method is naturally limited to 32 bits max.- Parameters:
bitContainer- an integer containing the bits to be written outnofBits- the number of bits to written out, minimum 0, maximum 32.
-
write
void write(long bitContainer, int nofBits) Write specified number of bits supplied in the long value. The method is naturally limited to 64 bits max.- Parameters:
bitContainer- an integer containing the bits to be written outnofBits- the number of bits to written out, minimum 0, maximum 64.
-
write
void write(byte bitContainer, int nofBits) Write specified number of bits supplied in the byte value. The method is naturally limited to 8 bits max.- Parameters:
bitContainer- an integer containing the bits to be written outnofBits- the number of bits to written out, minimum 0, maximum 8.
-
write
void write(boolean bit) Write a single bit specified in the boolean argument.- Parameters:
bit- emit 1 if true, 0 otherwise.
-
write
void write(boolean bit, long repeat) Write a single bit specified in the boolean argument repeatedly.- Parameters:
bit- emit 1 if true, 0 otherwise.repeat- the number of bits to emit.
-