public class ByteReader extends Object
| Modifier and Type | Field and Description |
|---|---|
static ByteOrder |
DEFAULT_BYTE_ORDER
Default read byte order
|
| Constructor and Description |
|---|
ByteReader(byte[] bytes)
Constructor
|
ByteReader(byte[] bytes,
ByteOrder byteOrder)
Constructor
|
ByteReader(InputStream inputStream)
Constructor
|
ByteReader(InputStream inputStream,
ByteOrder byteOrder)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the byte reader
|
ByteOrder |
getByteOrder()
Get the byte order
|
byte[] |
getBytes()
Get the bytes
|
InputStream |
getInputStream()
Get the output stream
|
int |
getNextByte()
Get the next byte to be read
|
byte |
readByte()
Read a byte
|
byte[] |
readBytes(int num)
Read the number of bytes
|
double |
readDouble()
Read a double
|
int |
readInt()
Read an integer
|
String |
readString(int num)
Read a String from the provided number of bytes
|
long |
readUnsignedInt()
Read an unsigned integer
|
void |
setByteOrder(ByteOrder byteOrder)
Set the byte order
|
public static final ByteOrder DEFAULT_BYTE_ORDER
public ByteReader(byte[] bytes)
bytes - bytespublic ByteReader(InputStream inputStream)
inputStream - input streampublic ByteReader(byte[] bytes,
ByteOrder byteOrder)
bytes - bytesbyteOrder - byte orderpublic ByteReader(InputStream inputStream, ByteOrder byteOrder)
inputStream - input streambyteOrder - byte orderpublic byte[] getBytes()
public InputStream getInputStream()
public void close()
public int getNextByte()
public ByteOrder getByteOrder()
public void setByteOrder(ByteOrder byteOrder)
byteOrder - byte orderpublic String readString(int num) throws IOException
num - number of bytesIOException - upon errorpublic byte[] readBytes(int num)
throws IOException
num - number of bytesIOException - upon errorpublic byte readByte()
throws IOException
IOException - upon errorpublic int readInt()
throws IOException
IOException - upon errorpublic long readUnsignedInt()
throws IOException
IOException - upon errorpublic double readDouble()
throws IOException
IOException - upon errorCopyright © 2021 National Geospatial-Intelligence Agency. All rights reserved.