Package mil.nga.sf.util
Class ByteReader
- java.lang.Object
- 
- mil.nga.sf.util.ByteReader
 
- 
 public class ByteReader extends Object Read through a byte array- Author:
- osbornb
 
- 
- 
Field SummaryFields Modifier and Type Field Description static ByteOrderDEFAULT_BYTE_ORDERDefault read byte order
 - 
Constructor SummaryConstructors Constructor Description ByteReader(byte[] bytes)ConstructorByteReader(byte[] bytes, ByteOrder byteOrder)ConstructorByteReader(InputStream inputStream)ConstructorByteReader(InputStream inputStream, ByteOrder byteOrder)Constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the byte readerByteOrdergetByteOrder()Get the byte orderbyte[]getBytes()Get the bytesInputStreamgetInputStream()Get the output streamintgetNextByte()Get the next byte to be readbytereadByte()Read a bytebyte[]readBytes(int num)Read the number of bytesdoublereadDouble()Read a doubleintreadInt()Read an integerStringreadString(int num)Read a String from the provided number of byteslongreadUnsignedInt()Read an unsigned integervoidsetByteOrder(ByteOrder byteOrder)Set the byte order
 
- 
- 
- 
Field Detail- 
DEFAULT_BYTE_ORDERpublic static final ByteOrder DEFAULT_BYTE_ORDER Default read byte order- Since:
- 2.0.3
 
 
- 
 - 
Constructor Detail- 
ByteReaderpublic ByteReader(byte[] bytes) Constructor- Parameters:
- bytes- bytes
 
 - 
ByteReaderpublic ByteReader(InputStream inputStream) Constructor- Parameters:
- inputStream- input stream
- Since:
- 2.0.3
 
 - 
ByteReaderpublic ByteReader(byte[] bytes, ByteOrder byteOrder)Constructor- Parameters:
- bytes- bytes
- byteOrder- byte order
- Since:
- 2.0.3
 
 - 
ByteReaderpublic ByteReader(InputStream inputStream, ByteOrder byteOrder) Constructor- Parameters:
- inputStream- input stream
- byteOrder- byte order
- Since:
- 2.0.3
 
 
- 
 - 
Method Detail- 
getBytespublic byte[] getBytes() Get the bytes- Returns:
- bytes
- Since:
- 2.0.3
 
 - 
getInputStreampublic InputStream getInputStream() Get the output stream- Returns:
- output stream
- Since:
- 2.0.3
 
 - 
closepublic void close() Close the byte reader- Since:
- 2.0.3
 
 - 
getNextBytepublic int getNextByte() Get the next byte to be read- Returns:
- next byte to be read
 
 - 
getByteOrderpublic ByteOrder getByteOrder() Get the byte order- Returns:
- byte order
 
 - 
setByteOrderpublic void setByteOrder(ByteOrder byteOrder) Set the byte order- Parameters:
- byteOrder- byte order
 
 - 
readStringpublic String readString(int num) throws IOException Read a String from the provided number of bytes- Parameters:
- num- number of bytes
- Returns:
- String
- Throws:
- IOException- upon error
 
 - 
readBytespublic byte[] readBytes(int num) throws IOExceptionRead the number of bytes- Parameters:
- num- number of bytes
- Returns:
- bytes
- Throws:
- IOException- upon error
 
 - 
readBytepublic byte readByte() throws IOExceptionRead a byte- Returns:
- byte
- Throws:
- IOException- upon error
 
 - 
readIntpublic int readInt() throws IOExceptionRead an integer- Returns:
- integer
- Throws:
- IOException- upon error
 
 - 
readUnsignedIntpublic long readUnsignedInt() throws IOExceptionRead an unsigned integer- Returns:
- unsigned integer
- Throws:
- IOException- upon error
 
 - 
readDoublepublic double readDouble() throws IOExceptionRead a double- Returns:
- double
- Throws:
- IOException- upon error
 
 
- 
 
-