Package org.apache.poi.util
Class LittleEndianByteArrayInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.apache.poi.util.LittleEndianByteArrayInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
public class LittleEndianByteArrayInputStream
extends ByteArrayInputStream
implements LittleEndianInput
Adapts a plain byte array to
LittleEndianInput-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
ConstructorsConstructorDescriptionLittleEndianByteArrayInputStream(byte[] buf) Creates aLittleEndianByteArrayInputStreamso that it usesbufas its buffer array.LittleEndianByteArrayInputStream(byte[] buf, int offset) CreatesLittleEndianByteArrayInputStreamthat usesbufas its buffer array.LittleEndianByteArrayInputStream(byte[] buf, int offset, int length) CreatesLittleEndianByteArrayInputStreamthat usesbufas its buffer array. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckPosition(int i) intbytereadByte()doublevoidreadFully(byte[] buffer) voidreadFully(byte[] buffer, int off, int len) intreadInt()longreadLong()voidreadPlain(byte[] buf, int off, int len) Usually acts the same asLittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filledshortintlongreadUInt()intvoidsetReadIndex(int pos) Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytes, skipNBytesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.poi.util.LittleEndianInput
available
-
Constructor Details
-
LittleEndianByteArrayInputStream
public LittleEndianByteArrayInputStream(byte[] buf, int offset, int length) CreatesLittleEndianByteArrayInputStreamthat usesbufas its buffer array. The initial value ofposisoffsetand the initial value ofcountis the minimum ofoffset+lengthandbuf.length. The buffer array is not copied. The buffer's mark is set to the specified offset.- Parameters:
buf- the input buffer.offset- the offset in the buffer of the first byte to read.length- the maximum number of bytes to read from the buffer.
-
LittleEndianByteArrayInputStream
public LittleEndianByteArrayInputStream(byte[] buf, int offset) CreatesLittleEndianByteArrayInputStreamthat usesbufas its buffer array. The initial value ofposisoffsetand the initial value ofcountis the minimum ofoffset+buf.lengthandbuf.length. The buffer array is not copied. The buffer's mark is set to the specified offset.- Parameters:
buf- the input buffer.offset- the offset in the buffer of the first byte to read.
-
LittleEndianByteArrayInputStream
public LittleEndianByteArrayInputStream(byte[] buf) Creates aLittleEndianByteArrayInputStreamso that it usesbufas its buffer array. The buffer array is not copied. The initial value ofposis0and the initial value ofcountis the length ofbuf.- Parameters:
buf- the input buffer.
-
-
Method Details
-
checkPosition
protected void checkPosition(int i) -
getReadIndex
public int getReadIndex() -
setReadIndex
public void setReadIndex(int pos) -
readByte
public byte readByte()- Specified by:
readBytein interfaceLittleEndianInput
-
readInt
public int readInt()- Specified by:
readIntin interfaceLittleEndianInput
-
readLong
public long readLong()- Specified by:
readLongin interfaceLittleEndianInput
-
readShort
public short readShort()- Specified by:
readShortin interfaceLittleEndianInput
-
readUByte
public int readUByte()- Specified by:
readUBytein interfaceLittleEndianInput
-
readUShort
public int readUShort()- Specified by:
readUShortin interfaceLittleEndianInput
-
readUInt
public long readUInt() -
readDouble
public double readDouble()- Specified by:
readDoublein interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buffer, int off, int len) - Specified by:
readFullyin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buffer) - Specified by:
readFullyin interfaceLittleEndianInput
-
readPlain
public void readPlain(byte[] buf, int off, int len) Description copied from interface:LittleEndianInputUsually acts the same asLittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled- Specified by:
readPlainin interfaceLittleEndianInput- Parameters:
buf- the byte array to receive the bytesoff- the start offset into the byte arraylen- the amount of bytes to fill
-