Class LittleEndianInput

java.lang.Object
com.google.common.geometry.LittleEndianInput

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

  • Constructor Details

    • LittleEndianInput

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

    • readByte

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

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

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

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

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

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

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

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

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