|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.presentation.stream.DataReader
biz.c24.io.api.presentation.stream.ByteAlignedBitDataReader
biz.c24.io.api.presentation.stream.BitDataReader
public class BitDataReader
Bit aligned data stream reader.
Provides the byte stream processing as bit sequence.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
DataReader.Locator |
Field Summary |
---|
Fields inherited from class biz.c24.io.api.presentation.stream.ByteAlignedBitDataReader |
---|
buffer, stream |
Fields inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
count, eof, locator, pos |
Constructor Summary | |
---|---|
BitDataReader(InputStream in)
Constructs the bit sequence stream with underlied input stream. |
Method Summary | |
---|---|
protected DataReader.Locator |
instantiateLocator()
|
byte[] |
read(int length)
Reads bytes from this byte-input stream into the specified byte array, starting at the given offset. |
byte |
readByte(int length)
Reades one byte from an input stream. |
int |
readInteger(int length)
Reades four bytes from an input stream. |
long |
readLong(int length)
Reades eight bytes from an input stream. |
protected long |
readPrimitives(int length)
|
short |
readShort(int length)
Reades two bytes from an input stream. |
byte |
readUnsignedByte(int length)
Reades one byte from an input stream. |
int |
readUnsignedInteger(int length)
Reades four bytes from an input stream. |
long |
readUnsignedLong(int length)
Reades eight bytes from an input stream. |
short |
readUnsignedShort(int length)
Reades two bytes from an input stream. |
void |
rollback(DataReader.Locator locator)
See the general contract of the rollback method of
DataReader . |
int |
skip(int n)
See the general contract of the skip method of DataReader . |
Methods inherited from class biz.c24.io.api.presentation.stream.ByteAlignedBitDataReader |
---|
available, availableBytes, checkLength, checkTheSign, close, compact, fill, startsFrom, updateValue, updateValue |
Methods inherited from class biz.c24.io.api.presentation.stream.DataReader |
---|
ensureOpen, eof, getDataStream, getLocator, getLookAhead, getLookBehind, mark, setLookAhead, setLookBehind, updateLocator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitDataReader(InputStream in)
in
- The underlied input stream.Method Detail |
---|
public byte readByte(int length) throws IOException
read..()
method with same length specified.
readByte
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..8).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 8.
IOException
- if an I/O error occurs.read(int)
public byte readUnsignedByte(int length) throws IOException
read..()
method with same length specified.
readUnsignedByte
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..8).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 8.
IOException
- if an I/O error occurs.read(int)
public short readShort(int length) throws IOException
read..()
method with same length specified.
readShort
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..16).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 16.
IOException
- if an I/O error occurs.readByte(int)
,
read(int)
public short readUnsignedShort(int length) throws IOException
read..()
method with same length specified.
readUnsignedShort
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..16).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 16.
IOException
- if an I/O error occurs.readByte(int)
,
read(int)
public int readInteger(int length) throws IOException
read..()
method with same length specified.
readInteger
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..32).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 32.
IOException
- if an I/O error occurs.readShort(int)
,
readByte(int)
,
read(int)
public int readUnsignedInteger(int length) throws IOException
read..()
method with same length specified.
readUnsignedInteger
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..32).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 32.
IOException
- if an I/O error occurs.readShort(int)
,
readByte(int)
,
read(int)
public long readLong(int length) throws IOException
read..()
method with same length specified.
readLong
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..64).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 64.
IOException
- if an I/O error occurs.readShort(int)
,
readByte(int)
,
read(int)
public long readUnsignedLong(int length) throws IOException
read..()
method with same length specified.
readUnsignedLong
in class ByteAlignedBitDataReader
length
- the number of bits to read (allowed values 1..64).
IllegalArgumentException
- if specified length is
below or equals to 0 or greater than 64.
IOException
- if an I/O error occurs.readShort(int)
,
readByte(int)
,
read(int)
public byte[] read(int length) throws IOException
This method implements the general contract of the corresponding
method of the read
class. As an
additional convenience, it attempts to read as many bytes as possible by
repeatedly invoking the InputStream
read
method of the underlying
stream. This iterated read
continues until one of the
following conditions becomes true:
read
method of the underlying stream returns
-1
, indicating end-of-file, or
available
method of the underlying stream returns
zero, indicating that further input requests would block.
read
on the underlying stream returns
-1
to indicate end-of-file then this method returns
-1
. Otherwise this method returns the number of bytes
actually read.
Subclasses of this class are encouraged, but not required, to attempt to read as many bytes as possible in the same fashion.
read
in class ByteAlignedBitDataReader
length
- number of bits to read.
-1
if the end of the
stream has been reached.
IOException
- if an I/O error occurs.public int skip(int n) throws IOException
skip
method of DataReader
.
skip
in class ByteAlignedBitDataReader
n
- the number of bytes to be skipped.
IOException
- if an I/O error occurs.public void rollback(DataReader.Locator locator)
rollback
method of
DataReader
.
rollback
in class DataReader
locator
- the location of point within data stream to where location should be rolled back.
IllegalStateException
- If location is out from allowed range.DataReader.mark()
protected DataReader.Locator instantiateLocator()
instantiateLocator
in class ByteAlignedBitDataReader
protected long readPrimitives(int length) throws IOException
readPrimitives
in class ByteAlignedBitDataReader
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |