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
  • Constructor Details

    • LittleEndianByteArrayInputStream

      public LittleEndianByteArrayInputStream(byte[] buf, int offset, int length)
      Creates LittleEndianByteArrayInputStream that uses buf as its buffer array. The initial value of pos is offset and the initial value of count is the minimum of offset+length and buf.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)
      Creates LittleEndianByteArrayInputStream that uses buf as its buffer array. The initial value of pos is offset and the initial value of count is the minimum of offset+buf.length and buf.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 a LittleEndianByteArrayInputStream so that it uses buf as its buffer array. The buffer array is not copied. The initial value of pos is 0 and the initial value of count is the length of buf.
      Parameters:
      buf - the input buffer.
  • Method Details

    • getReadIndex

      public int getReadIndex()
    • setReadIndex

      public void setReadIndex(int pos)
    • readByte

      public byte readByte()
      Specified by:
      readByte in interface LittleEndianInput
    • readInt

      public int readInt()
      Specified by:
      readInt in interface LittleEndianInput
    • readLong

      public long readLong()
      Specified by:
      readLong in interface LittleEndianInput
    • readShort

      public short readShort()
      Specified by:
      readShort in interface LittleEndianInput
    • readUByte

      public int readUByte()
      Specified by:
      readUByte in interface LittleEndianInput
    • readUShort

      public int readUShort()
      Specified by:
      readUShort in interface LittleEndianInput
    • readUInt

      public long readUInt()
    • readDouble

      public double readDouble()
      Specified by:
      readDouble in interface LittleEndianInput
    • readFully

      public void readFully(byte[] buffer, int off, int len)
      Specified by:
      readFully in interface LittleEndianInput
    • readFully

      public void readFully(byte[] buffer)
      Specified by:
      readFully in interface LittleEndianInput
    • readPlain

      public void readPlain(byte[] buf, int off, int len)
      Description copied from interface: LittleEndianInput
      Usually acts the same as LittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled
      Specified by:
      readPlain in interface LittleEndianInput
      Parameters:
      buf - the byte array to receive the bytes
      off - the start offset into the byte array
      len - the amount of bytes to fill
    • limit

      public void limit(int size)
      Change the limit of the ByteArrayInputStream
      Parameters:
      size - the new limit - is truncated to length of internal buffer