Package com.google.common.geometry
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.
-
-
Constructor Summary
Constructors Constructor Description LittleEndianInput(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 voidclose()Closes the underlying stream.bytereadByte()Reads a byte.byte[]readBytes(int size)Reads a fixed size of bytes from the input.doublereadDouble()Reads a little-endian IEEE754 64-bit double.floatreadFloat()Reads a little-endian IEEE754 32-bit float.intreadInt()Reads a little-endian signed integer.longreadLong()Reads a little-endian signed long.intreadVarint32()Reads a variable-encoded signed integer withreadVarint64().longreadVarint64()Reads a variable-encoded signed long withEncodedInts.readVarint64(InputStream)
-
-
-
Constructor Detail
-
LittleEndianInput
public LittleEndianInput(InputStream input)
Constructs a little-endian input that reads from the given stream.
-
-
Method Detail
-
readByte
public byte readByte() throws IOExceptionReads a byte.- Throws:
IOException- ifinput.read()throws anIOExceptionor returns -1 (EOF).
-
readBytes
public byte[] readBytes(int size) throws IOExceptionReads 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 IOExceptionReads a little-endian signed integer.- Throws:
IOException- if past end of input or error in underlying stream
-
readLong
public long readLong() throws IOExceptionReads a little-endian signed long.- Throws:
IOException- if past end of input or error in underlying stream
-
readFloat
public float readFloat() throws IOExceptionReads a little-endian IEEE754 32-bit float.- Throws:
IOException- if past end of input or error in underlying stream
-
readDouble
public double readDouble() throws IOExceptionReads a little-endian IEEE754 64-bit double.- Throws:
IOException- if past end of input or error in underlying stream
-
readVarint32
public int readVarint32() throws IOExceptionReads a variable-encoded signed integer withreadVarint64().- Throws:
IOException- if past end of input or error in underlying stream
-
readVarint64
public long readVarint64() throws IOExceptionReads a variable-encoded signed long withEncodedInts.readVarint64(InputStream)- Throws:
IOException- if past end of input or error in underlying stream
-
close
public void close() throws IOExceptionCloses the underlying stream.- Throws:
IOException
-
-