Class LittleEndianInput


  • @GwtCompatible
    public final class LittleEndianInput
    extends java.lang.Object
    Simple utility for reading little endian primitives from a stream.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.InputStream input  
    • Constructor Summary

      Constructors 
      Constructor Description
      LittleEndianInput​(java.io.InputStream input)
      Constructs a little-endian input that reads from the given stream.
    • Field Detail

      • input

        private final java.io.InputStream input
    • Constructor Detail

      • LittleEndianInput

        public LittleEndianInput​(java.io.InputStream input)
        Constructs a little-endian input that reads from the given stream.
    • Method Detail

      • readByte

        public byte readByte()
                      throws java.io.IOException
        Reads a byte.
        Throws:
        java.io.IOException - if input.read() throws an IOException or returns -1 (EOF).
      • readBytes

        public byte[] readBytes​(int size)
                         throws java.io.IOException
        Reads a fixed size of bytes from the input.
        Parameters:
        size - the number of bytes to read.
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readInt

        public int readInt()
                    throws java.io.IOException
        Reads a little-endian signed integer.
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readLong

        public long readLong()
                      throws java.io.IOException
        Reads a little-endian signed long.
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Reads a little-endian IEEE754 32-bit float.
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readDouble

        public double readDouble()
                          throws java.io.IOException
        Reads a little-endian IEEE754 64-bit double.
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readVarint32

        public int readVarint32()
                         throws java.io.IOException
        Reads a variable-encoded signed integer with readVarint64().
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • readVarint64

        public long readVarint64()
                          throws java.io.IOException
        Reads a variable-encoded signed long with EncodedInts.readVarint64(InputStream)
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • close

        public void close()
                   throws java.io.IOException
        Closes the underlying stream.
        Throws:
        java.io.IOException