public class ByteReader extends Object
| 构造器 | 说明 |
|---|---|
ByteReader(byte[] bytes) |
Constructor
|
ByteReader(byte[] bytes,
ByteOrder byteOrder) |
Constructor
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
byteLength() |
Get the byte length
|
ByteOrder |
getByteOrder() |
Get the byte order
|
int |
getNextByte() |
Get the next byte to be read
|
boolean |
hasByte() |
Check if there is at least one more byte left to read
|
boolean |
hasByte(int offset) |
Check if there is at least one more byte left to read
|
boolean |
hasBytes(int count) |
Check if there are the provided number of bytes left to read
|
boolean |
hasBytes(int offset,
int count) |
Check if there are the provided number of bytes left to read
|
byte |
readByte() |
Read a byte
|
byte |
readByte(int offset) |
Read a byte
|
byte[] |
readBytes(int num) |
Read a number of bytes
|
byte[] |
readBytes(int offset,
int num) |
Read a number of bytes
|
double |
readDouble() |
Read a double
|
double |
readDouble(int offset) |
Read a double
|
float |
readFloat() |
Read a float
|
float |
readFloat(int offset) |
Read a float
|
int |
readInt() |
Read an integer
|
int |
readInt(int offset) |
Read an integer
|
short |
readShort() |
Read a short
|
short |
readShort(int offset) |
Read a short
|
String |
readString(int num) |
Read a String from the provided number of bytes
|
String |
readString(int offset,
int num) |
Read a String from the provided number of bytes
|
short |
readUnsignedByte() |
Read an unsigned byte
|
short |
readUnsignedByte(int offset) |
Read an unsigned byte
|
long |
readUnsignedInt() |
Read an unsigned int
|
long |
readUnsignedInt(int offset) |
Read an unsigned int
|
int |
readUnsignedShort() |
Read an unsigned short
|
int |
readUnsignedShort(int offset) |
Read an unsigned short
|
void |
setByteOrder(ByteOrder byteOrder) |
Set the byte order
|
void |
setNextByte(int nextByte) |
Set the next byte to be read
|
public ByteReader(byte[] bytes)
bytes - bytespublic ByteReader(byte[] bytes,
ByteOrder byteOrder)
bytes - bytesbyteOrder - byte orderpublic int getNextByte()
public void setNextByte(int nextByte)
nextByte - next bytepublic ByteOrder getByteOrder()
public void setByteOrder(ByteOrder byteOrder)
byteOrder - byte orderpublic boolean hasByte()
public boolean hasByte(int offset)
offset - byte offsetpublic boolean hasBytes(int count)
count - number of bytespublic boolean hasBytes(int offset,
int count)
offset - byte offsetcount - number of bytespublic String readString(int num) throws UnsupportedEncodingException
num - number of bytesUnsupportedEncodingExceptionpublic String readString(int offset, int num) throws UnsupportedEncodingException
offset - byte offsetnum - number of bytesUnsupportedEncodingExceptionpublic byte readByte()
public byte readByte(int offset)
offset - byte offsetpublic short readUnsignedByte()
public short readUnsignedByte(int offset)
offset - byte offsetpublic byte[] readBytes(int num)
num - number of bytespublic byte[] readBytes(int offset,
int num)
offset - byte offsetnum - number of bytespublic short readShort()
public short readShort(int offset)
offset - byte offsetpublic int readUnsignedShort()
public int readUnsignedShort(int offset)
offset - byte offsetpublic int readInt()
public int readInt(int offset)
offset - byte offsetpublic long readUnsignedInt()
public long readUnsignedInt(int offset)
offset - byte offsetpublic float readFloat()
public float readFloat(int offset)
offset - byte offsetpublic double readDouble()
public double readDouble(int offset)
offset - byte offsetpublic int byteLength()
Copyright © 2019. All rights reserved.