public class ByteUtils
extends java.lang.Object
Constructor and Description |
---|
ByteUtils(byte[] data) |
Modifier and Type | Method and Description |
---|---|
static int |
byteToUint(byte b)
Converts the byte into an unsigned int.
|
boolean |
compareBytes(byte[] other,
int offset,
int length) |
byte[] |
getByteChunk(byte[] buffer,
int offset,
int len) |
byte[] |
getBytes() |
int |
getInt16(int offset)
Gets a 16bit int (Big Endian, MSB first) from the buffer at the given
offset.
|
int |
getInt16LE(int offset)
Gets a 16bit int (Little Endian, LSB first) from the buffer at the given
offset.
|
int |
getInt8(int offset)
Gets an 8bit int from the buffer at the given offset.
|
int |
getLength() |
static java.lang.String |
hex(int value,
int digits) |
void |
setByteChunk(byte[] buffer,
int offset) |
void |
setByteChunk(byte[] buffer,
int offset,
int len) |
void |
setInt16(int val,
int offset) |
void |
setInt16LE(int val,
int offset) |
void |
setInt8(int val,
int offset) |
java.lang.String |
toHex(int length) |
public static final int byteToUint(byte b)
b
- Byte to convert.public static final java.lang.String hex(int value, int digits)
public boolean compareBytes(byte[] other, int offset, int length)
public final byte[] getByteChunk(byte[] buffer, int offset, int len)
public byte[] getBytes()
public final int getInt16(int offset)
offset
- Data offset.public final int getInt16LE(int offset)
offset
- Data offset.public final int getInt8(int offset)
offset
- Data offset.public final int getLength()
public final void setByteChunk(byte[] buffer, int offset)
public final void setByteChunk(byte[] buffer, int offset, int len)
public final void setInt16(int val, int offset)
public final void setInt16LE(int val, int offset)
public final void setInt8(int val, int offset)
public final java.lang.String toHex(int length)