Package com.google.common.geometry
Class LittleEndianInput
java.lang.Object
com.google.common.geometry.LittleEndianInput
Simple utility for reading little endian primitives from a stream.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLittleEndianInput(InputStream input) Constructs a little-endian input that reads from the given stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying stream.bytereadByte()Reads a byte.byte[]readBytes(int size) Reads a fixed size of bytes from the input.doubleReads a little-endian IEEE754 64-bit double.floatReads a little-endian IEEE754 32-bit float.intreadInt()Reads a little-endian signed integer.longreadLong()Reads a little-endian signed long.intReads a variable-encoded signed integer withreadVarint64().longReads a variable-encoded signed long withEncodedInts.readVarint64(InputStream)
-
Field Details
-
input
-
-
Constructor Details
-
LittleEndianInput
Constructs a little-endian input that reads from the given stream.
-
-
Method Details
-
readByte
Reads a byte.- Throws:
IOException- ifinput.read()throws anIOExceptionor returns -1 (EOF).
-
readBytes
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
Reads a little-endian signed integer.- Throws:
IOException- if past end of input or error in underlying stream
-
readLong
Reads a little-endian signed long.- Throws:
IOException- if past end of input or error in underlying stream
-
readFloat
Reads a little-endian IEEE754 32-bit float.- Throws:
IOException- if past end of input or error in underlying stream
-
readDouble
Reads a little-endian IEEE754 64-bit double.- Throws:
IOException- if past end of input or error in underlying stream
-
readVarint32
Reads a variable-encoded signed integer withreadVarint64().- Throws:
IOException- if past end of input or error in underlying stream
-
readVarint64
Reads a variable-encoded signed long withEncodedInts.readVarint64(InputStream)- Throws:
IOException- if past end of input or error in underlying stream
-
close
Closes the underlying stream.- Throws:
IOException
-