Package com.github.jinahya.bit.io
Class ByteInputAdapter
java.lang.Object
com.github.jinahya.bit.io.ByteInputAdapter
- All Implemented Interfaces:
BitInput
- Author:
- Jin Kwon <onacit_at_gmail.com>
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionByteInputAdapter
(ByteInput input) Creates a new instance on top of specified byte input. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.jinahya.bit.io.BitInput
readBoolean, readByte, readChar, readDouble, readFloat, readLong, readObject, readShort, skip
-
Constructor Details
-
ByteInputAdapter
Creates a new instance on top of specified byte input.- Parameters:
input
- the byte input.
-
-
Method Details
-
readInt
Description copied from interface:BitInput
Reads anint
value of specified number of bits.- Specified by:
readInt
in interfaceBitInput
- Parameters:
unsigned
- a flag for indicating unsigned value;true
for unsigned,false
for signed.size
- the number of bits to read; between1
and (32 - (unsigned ? 1: 0
)), both inclusive.- Returns:
- an
int
value ofsize
bits. - Throws:
IOException
- if an I/O error occurs.
-
align
Description copied from interface:BitInput
Aligns to specified number of bytes by reading (and discarding) required number of bits.- Specified by:
align
in interfaceBitInput
- Parameters:
bytes
- the number of bytes to align; must be positive.- Returns:
- the number of bits discarded; non-negative, always.
- Throws:
IOException
- if an I/O error occurs.
-
reset
public void reset()Description copied from interface:BitInput
Resets the total number of bytes read so far to0
.
-