|
|||||||||
| 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 |
| Constructor Summary | |
|---|---|
BitDataReader(InputStream in)
Constructs the bit sequence stream with underlied input stream. |
|
| Method Summary | |
|---|---|
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. |
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, close, startsFrom |
| Methods inherited from class biz.c24.io.api.presentation.stream.DataReader |
|---|
eof, getDataStream, getLocator, getLookAhead, getLookBehind, mark, setLookAhead, setLookBehind |
| Methods inherited from class java.lang.Object |
|---|
equals, 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReaderlength - 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 InputStreamread 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 ByteAlignedBitDataReaderlength - 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 ByteAlignedBitDataReadern - 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 DataReaderlocator - the location of point within data stream to where location should be rolled back.
IllegalStateException - If location is out from allowed range.DataReader.mark()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||