Package com.google.common.geometry
Class LittleEndianInput
- java.lang.Object
-
- com.google.common.geometry.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying stream.byte
readByte()
Reads a byte.byte[]
readBytes(int size)
Reads a fixed size of bytes from the input.double
readDouble()
Reads a little-endian IEEE754 64-bit double.float
readFloat()
Reads a little-endian IEEE754 32-bit float.int
readInt()
Reads a little-endian signed integer.long
readLong()
Reads a little-endian signed long.int
readVarint32()
Reads a variable-encoded signed integer withreadVarint64()
.long
readVarint64()
Reads a variable-encoded signed long withEncodedInts.readVarint64(InputStream)
-
-
-
Method Detail
-
readByte
public byte readByte() throws java.io.IOException
Reads a byte.- Throws:
java.io.IOException
- ifinput.read()
throws anIOException
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 withreadVarint64()
.- 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 withEncodedInts.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
-
-