public final class DataInputBlock
extends java.lang.Object
available()
method to detect end-of-buffer
and move to the next data block when the current is exhausted.
For optimisation reasons, no error handling is performed in this class. Thus, mistakes in
calling code ran may raise ugly exceptions here, like ArrayIndexOutOfBoundsException
,
etc .
The multi-byte primitive input methods (readUShortLE()
, readIntLE()
and
readLongLE()
) have corresponding 'spanning read' methods which (when required) perform
a read across the block boundary. These spanning read methods take the previous
DataInputBlock
as a parameter.
Reads of larger amounts of data (into byte array buffers) must be managed by the caller
since these could conceivably involve more than two blocks.Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
readFully(byte[] buf,
int off,
int len)
Reads len bytes from this block into the supplied buffer.
|
int |
readIntLE()
Reads an int which was encoded in little endian format.
|
int |
readIntLE(DataInputBlock prevBlock,
int prevBlockAvailable)
Reads an int which spans the end of prevBlock and the start of this block.
|
long |
readLongLE()
Reads a long which was encoded in little endian format.
|
long |
readLongLE(DataInputBlock prevBlock,
int prevBlockAvailable)
Reads a long which spans the end of prevBlock and the start of this block.
|
int |
readUByte() |
int |
readUShortLE()
Reads a short which was encoded in little endian format.
|
int |
readUShortLE(DataInputBlock prevBlock)
Reads a short which spans the end of prevBlock and the start of this block.
|
public int available()
public int readUByte()
public int readUShortLE()
public int readUShortLE(DataInputBlock prevBlock)
public int readIntLE()
public int readIntLE(DataInputBlock prevBlock, int prevBlockAvailable)
public long readLongLE()
public long readLongLE(DataInputBlock prevBlock, int prevBlockAvailable)
public void readFully(byte[] buf, int off, int len)
Copyright © 2005-2010 Potix Corporation. All Rights Reserved.