org.apache.poi.poifs.storage
Class DataInputBlock
- java.lang.Object
-
- org.apache.poi.poifs.storage.DataInputBlock
-
public final class DataInputBlock extends java.lang.ObjectWraps a byte array and provides simple data input access. Internally, this class maintains a buffer read index, so that for the most part, primitive data can be read in a data-input-stream-like manner. Note - the calling class should call theavailable()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, likeArrayIndexOutOfBoundsException, etc . The multi-byte primitive input methods (readUShortLE(),readIntLE()andreadLongLE()) have corresponding 'spanning read' methods which (when required) perform a read across the block boundary. These spanning read methods take the previousDataInputBlockas 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intavailable()voidreadFully(byte[] buf, int off, int len)Reads len bytes from this block into the supplied buffer.intreadIntLE()Reads an int which was encoded in little endian format.intreadIntLE(DataInputBlock prevBlock, int prevBlockAvailable)Reads an int which spans the end of prevBlock and the start of this block.longreadLongLE()Reads a long which was encoded in little endian format.longreadLongLE(DataInputBlock prevBlock, int prevBlockAvailable)Reads a long which spans the end of prevBlock and the start of this block.intreadUByte()intreadUShortLE()Reads a short which was encoded in little endian format.intreadUShortLE(DataInputBlock prevBlock)Reads a short which spans the end of prevBlock and the start of this block.
-
-
-
Method Detail
-
available
public int available()
-
readUByte
public int readUByte()
-
readUShortLE
public int readUShortLE()
Reads a short which was encoded in little endian format.
-
readUShortLE
public int readUShortLE(DataInputBlock prevBlock)
Reads a short which spans the end of prevBlock and the start of this block.
-
readIntLE
public int readIntLE()
Reads an int which was encoded in little endian format.
-
readIntLE
public int readIntLE(DataInputBlock prevBlock, int prevBlockAvailable)
Reads an int which spans the end of prevBlock and the start of this block.
-
readLongLE
public long readLongLE()
Reads a long which was encoded in little endian format.
-
readLongLE
public long readLongLE(DataInputBlock prevBlock, int prevBlockAvailable)
Reads a long which spans the end of prevBlock and the start of this block.
-
readFully
public void readFully(byte[] buf, int off, int len)Reads len bytes from this block into the supplied buffer.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG