public interface BitsOutput
Modifier and Type | Method and Description |
---|---|
int |
getLength()
Returns the data length in bits (1 to 32 bits).
|
void |
writeBits(byte[] data,
boolean signExtends)
Writes
data.length data from the specified short array to this output
stream. |
void |
writeBits(byte[] data,
int off,
int len,
boolean signExtends)
Writes
len data from the specified short array starting at offset off to
this output stream. |
void |
writeBits(int val)
The data to send is masked using the following formula:
val &= (1 << getLength()) - 1 |
void |
writeBits(int[] data)
Writes
data.length data from the specified integer array to this output
stream. |
void |
writeBits(int[] data,
int off,
int len)
Writes
len data from the specified integer array starting at offset off to
this output stream. |
void |
writeBits(short[] data,
boolean signExtends)
Writes
data.length data from the specified short array to this output
stream. |
void |
writeBits(short[] data,
int off,
int len,
boolean signExtends)
Writes
len data from the specified short array starting at offset off to
this output stream. |
int getLength()
void writeBits(int val) throws IOException
val &= (1 << getLength()) - 1
IOException
- if an I/O error occurs. In particular, an IOException may be thrown
if the output stream has been closed.void writeBits(int[] data) throws IOException
data.length
data from the specified integer array to this output
stream. The general contract for writeBits(data)
is that it should have exactly
the same effect as the call writeBits(data, 0, data.length)
.data
- the data to sendIOException
- if an I/O error occurs. In particular, an IOException may be thrown
if the output stream has been closed.void writeBits(int[] data, int off, int len) throws IOException
len
data from the specified integer array starting at offset off
to
this output stream. The general contract for writeBits(b, off, len)
is that
some of the data in the array data
are written to the output stream in
order; element data[off]
is the first byte written and b[off+len-1]
is the
last data written by this operation.write
method of OutputStream
calls the write
method of one argument
on each of the data to be written out. Subclasses are encouraged to
override this method and provide a more efficient implementation.data
is null, a NullPointerException
is thrown.off
is negative, or len
is negative, or off+len
is greater than the
length of the array data
, then an IndexOutOfBoundsException
is thrown.data
- the data to sendoff
- the start offset in the data.len
- the number of data to write.if
- an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.IOException
void writeBits(short[] data, boolean signExtends) throws IOException
data.length
data from the specified short array to this output
stream. The general contract for writeBits(data, signExtends)
is that it should have exactly
the same effect as the call writeBits(b, 0, b.length, signExtends)
.data
- the data to sendsignExtends
- true to sign-extend the data in case of getLength()
> 16 (short
size)IOException
- if an I/O error occurs. In particular, an IOException may be thrown
if the output stream has been closed.void writeBits(short[] data, int off, int len, boolean signExtends) throws IOException
len
data from the specified short array starting at offset off
to
this output stream. The general contract for writeBits(b, off, len, signExtends)
is that
some of the data in the array data
are written to the output stream in
order; element data[off]
is the first byte written and b[off+len-1]
is the
last data written by this operation.write
method of OutputStream
calls the write
method of one argument
on each of the data to be written out. Subclasses are encouraged to
override this method and provide a more efficient implementation.data
is null, a NullPointerException
is thrown.off
is negative, or len
is negative, or off+len
is greater than the
length of the array data
, then an IndexOutOfBoundsException
is thrown.
getLength()
is higher than 16 (short
size), the data will are sign extended or not
according signExtends
boolean.data
- the data to sendoff
- the start offset in the data.len
- the number of data to write.signExtends
- true to sign-extend the data in case of getLength()
> 16 (short
size)if
- an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.IOException
void writeBits(byte[] data, boolean signExtends) throws IOException
data.length
data from the specified short array to this output
stream. The general contract for writeBits(data, signExtends)
is that it should have exactly
the same effect as the call writeBits(b, 0, b.length, signExtends)
.data
- the data to sendsignExtends
- true to sign-extend the data in case of getLength()
> 8 (byte
size)IOException
- if an I/O error occurs. In particular, an IOException may be thrown
if the output stream has been closed.void writeBits(byte[] data, int off, int len, boolean signExtends) throws IOException
len
data from the specified short array starting at offset off
to
this output stream. The general contract for writeBits(b, off, len, signExtends)
is that
some of the data in the array data
are written to the output stream in
order; element data[off]
is the first byte written and b[off+len-1]
is the
last data written by this operation.write
method of OutputStream
calls the write
method of one argument
on each of the data to be written out. Subclasses are encouraged to
override this method and provide a more efficient implementation.data
is null, a NullPointerException
is thrown.off
is negative, or len
is negative, or off+len
is greater than the
length of the array data
, then an IndexOutOfBoundsException
is thrown.
getLength()
is higher than 8 (byte
size), the data will are sign extended or not
according signExtends
boolean.data
- the data to sendoff
- the start offset in the data.len
- the number of data to write.signExtends
- true to sign-extend the data in case of getLength()
> 8 (byte
size)if
- an I/O error occurs. In particular, an IOException is thrown if the output stream is closed.IOException