Class LittleEndianInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, LittleEndianInput
    Direct Known Subclasses:
    ChunkedCipherInputStream

    public class LittleEndianInputStream
    extends java.io.FilterInputStream
    implements LittleEndianInput
    Wraps an InputStream providing LittleEndianInput

    This class does not buffer any input, so the stream read position maintained by this class is consistent with that of the inner stream.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      int getReadIndex()  
      void mark​(int readlimit)  
      int read​(byte[] b, int off, int len)  
      byte readByte()  
      double readDouble()  
      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
      void readFully​(byte[] buf)  
      void readFully​(byte[] buf, int off, int len)  
      int readInt()  
      long readLong()  
      void readPlain​(byte[] buf, int off, int len)
      Usually acts the same as LittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled
      short readShort()  
      int readUByte()  
      long readUInt()
      get an unsigned int value from an InputStream
      int readUShort()  
      void reset()  
      void skipFully​(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
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LittleEndianInputStream

        public LittleEndianInputStream​(java.io.InputStream is)
    • Method Detail

      • available

        public int available()
        Specified by:
        available in interface LittleEndianInput
        Overrides:
        available in class java.io.FilterInputStream
      • 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
      • readUInt

        public long readUInt()
        get an unsigned int value from an InputStream
        Returns:
        the unsigned int (32-bit) value
        Throws:
        java.lang.RuntimeException - wraps any IOException thrown from reading the stream.
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.FilterInputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • getReadIndex

        public int getReadIndex()
      • 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
      • skipFully

        public void skipFully​(int len)
                       throws java.io.IOException
        Throws:
        java.io.IOException