public class BitByteOutputStream extends BitOutputStream
Modifier and Type | Field and Description |
---|---|
protected byte |
byteToWrite
A byte to write to the stream.
|
bitOffset, buffer, bufferPointer, bufferSize, byteOffset, DEFAULT_SIZE, dos, logger
Constructor and Description |
---|
BitByteOutputStream()
Empty constructor, used for subclassing
|
BitByteOutputStream(File file)
Constructs an instance of the class for a given file
|
BitByteOutputStream(OutputStream is)
Constructs an instance of the class for a given stream
|
BitByteOutputStream(String filename)
Constructs an instance of the class for a given filename
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
byte |
getBitOffset()
Returns the bit offset in the last byte.
|
long |
getByteOffset()
Returns the byte offset of the stream.
|
byte |
getByteToWrite() |
void |
pad()
Fills the remaining bits of the current byte with 0s
|
int |
writeInt(int x,
int len)
Writes an integer x into the underlying OutputStream.
|
int |
writeUnary(int x)
Writes an integer x using unary encoding.
|
append, append, flush, padAndFlush, writeBinary, writeDelta, writeGamma, writeGolomb, writeInterpolativeCode, writeMinimalBinary, writeSkewedGolomb
public BitByteOutputStream(OutputStream is) throws IOException
is
- java.io.OutputStream the underlying input streamIOException
- if an I/O error occurspublic BitByteOutputStream(String filename) throws IOException
filename
- java.lang.String the name of the underlying fileIOException
- if an I/O error occurspublic BitByteOutputStream(File file) throws IOException
file
- java.io.File the underlying fileIOException
- if an I/O error occurspublic BitByteOutputStream()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class BitOutputStream
IOException
- if an I/O error occurspublic long getByteOffset()
getByteOffset
in interface BitOut
getByteOffset
in class BitOutputStream
public byte getBitOffset()
getBitOffset
in interface BitOut
getBitOffset
in class BitOutputStream
public int writeUnary(int x) throws IOException
writeUnary
in interface BitOut
writeUnary
in class BitOutputStream
x
- the number to writeIOException
- if an I/O error occurs.public int writeInt(int x, int len) throws IOException
writeInt
in interface BitOut
writeInt
in class BitOutputStream
x
- the int to writelen
- length of the int in bitsIOException
- if an I/O error occurs.public void pad() throws IOException
IOException
public byte getByteToWrite()
Terrier 4.0. Copyright © 2004-2014 University of Glasgow