Package org.apache.poi.util
Class LittleEndianByteArrayInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.ByteArrayInputStream
-
- org.apache.poi.util.LittleEndianByteArrayInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,LittleEndianInput
public class LittleEndianByteArrayInputStream extends java.io.ByteArrayInputStream implements LittleEndianInput
Adapts a plain byte array toLittleEndianInput
-
-
Constructor Summary
Constructors Constructor Description LittleEndianByteArrayInputStream(byte[] buf)
Creates aLittleEndianByteArrayInputStream
so that it usesbuf
as its buffer array.LittleEndianByteArrayInputStream(byte[] buf, int offset)
CreatesLittleEndianByteArrayInputStream
that usesbuf
as its buffer array.LittleEndianByteArrayInputStream(byte[] buf, int offset, int length)
CreatesLittleEndianByteArrayInputStream
that usesbuf
as its buffer array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getReadIndex()
byte
readByte()
double
readDouble()
void
readFully(byte[] buffer)
void
readFully(byte[] buffer, int off, int len)
int
readInt()
long
readLong()
void
readPlain(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 filledshort
readShort()
int
readUByte()
long
readUInt()
int
readUShort()
void
setReadIndex(int pos)
-
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.util.LittleEndianInput
available
-
-
-
-
Constructor Detail
-
LittleEndianByteArrayInputStream
public LittleEndianByteArrayInputStream(byte[] buf, int offset, int length)
CreatesLittleEndianByteArrayInputStream
that usesbuf
as its buffer array. The initial value ofpos
isoffset
and the initial value ofcount
is the minimum ofoffset+length
andbuf.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)
CreatesLittleEndianByteArrayInputStream
that usesbuf
as its buffer array. The initial value ofpos
isoffset
and the initial value ofcount
is the minimum ofoffset+buf.length
andbuf.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 aLittleEndianByteArrayInputStream
so that it usesbuf
as its buffer array. The buffer array is not copied. The initial value ofpos
is0
and the initial value ofcount
is the length ofbuf
.- Parameters:
buf
- the input buffer.
-
-
Method Detail
-
getReadIndex
public int getReadIndex()
-
setReadIndex
public void setReadIndex(int pos)
-
readByte
public byte readByte()
- Specified by:
readByte
in interfaceLittleEndianInput
-
readInt
public int readInt()
- Specified by:
readInt
in interfaceLittleEndianInput
-
readLong
public long readLong()
- Specified by:
readLong
in interfaceLittleEndianInput
-
readShort
public short readShort()
- Specified by:
readShort
in interfaceLittleEndianInput
-
readUByte
public int readUByte()
- Specified by:
readUByte
in interfaceLittleEndianInput
-
readUShort
public int readUShort()
- Specified by:
readUShort
in interfaceLittleEndianInput
-
readUInt
public long readUInt()
-
readDouble
public double readDouble()
- Specified by:
readDouble
in interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buffer, int off, int len)
- Specified by:
readFully
in interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buffer)
- Specified by:
readFully
in interfaceLittleEndianInput
-
readPlain
public void readPlain(byte[] buf, int off, int len)
Description copied from interface:LittleEndianInput
Usually acts the same asLittleEndianInput.readFully(byte[], int, int)
, but for an encrypted stream the raw (unencrypted) data is filled- Specified by:
readPlain
in interfaceLittleEndianInput
- Parameters:
buf
- the byte array to receive the bytesoff
- the start offset into the byte arraylen
- the amount of bytes to fill
-
-