Package org.apache.poi.util
Class LittleEndianInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.poi.util.LittleEndianInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable,LittleEndianInput
- Direct Known Subclasses:
ChunkedCipherInputStream
public class LittleEndianInputStream extends FilterInputStream implements LittleEndianInput
Wraps anInputStreamprovidingLittleEndianInputThis class does not buffer any input, so the stream read position maintained by this class is consistent with that of the inner stream.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description LittleEndianInputStream(InputStream is)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()intgetReadIndex()voidmark(int readlimit)intread(byte[] b, int off, int len)bytereadByte()doublereadDouble()floatreadFloat()get a float value, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java floatvoidreadFully(byte[] buf)voidreadFully(byte[] buf, 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 filledshortreadShort()intreadUByte()longreadUInt()get an unsigned int value from an InputStreamintreadUShort()voidreset()voidskipFully(int len)-
Methods inherited from class java.io.FilterInputStream
close, markSupported, read, read, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
LittleEndianInputStream
public LittleEndianInputStream(InputStream is)
-
-
Method Detail
-
available
public int available()
- Specified by:
availablein interfaceLittleEndianInput- Overrides:
availablein classFilterInputStream
-
readByte
public byte readByte()
- Specified by:
readBytein interfaceLittleEndianInput
-
readUByte
public int readUByte()
- Specified by:
readUBytein interfaceLittleEndianInput
-
readFloat
public float readFloat()
get a float value, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java float- Returns:
- the float (32-bit) value
-
readDouble
public double readDouble()
- Specified by:
readDoublein interfaceLittleEndianInput
-
readInt
public int readInt()
- Specified by:
readIntin interfaceLittleEndianInput
-
readUInt
public long readUInt()
get an unsigned int value from an InputStream- Returns:
- the unsigned int (32-bit) value
- Throws:
IllegalStateException- wraps any IOException thrown from reading the stream.
-
readLong
public long readLong()
- Specified by:
readLongin interfaceLittleEndianInput
-
readShort
public short readShort()
- Specified by:
readShortin interfaceLittleEndianInput
-
readUShort
public int readUShort()
- Specified by:
readUShortin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf)
- Specified by:
readFullyin interfaceLittleEndianInput
-
readFully
public void readFully(byte[] buf, int off, int len)- Specified by:
readFullyin interfaceLittleEndianInput
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
markin classFilterInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
getReadIndex
public int getReadIndex()
-
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
-
skipFully
public void skipFully(int len) throws IOException- Throws:
IOException
-
-