|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthla.rti1516.jlc.ByteWrapper
public class ByteWrapper
Utility class for managing data in byte arrays.
| Constructor Summary | |
|---|---|
ByteWrapper(byte[] buffer)
Constructs a ByteWrapper backed by the specified byte array. |
|
ByteWrapper(byte[] buffer,
int offset)
Constructs a ByteWrapper backed by the specified byte array. |
|
ByteWrapper(int length)
Construct a ByteWrapper backed by a byte array with the specified length. |
|
| Method Summary | |
|---|---|
void |
advance(int n)
Advances the current position by n. |
void |
align(int alignment)
Advances the current position until the specified alignment is achieved. |
byte[] |
array()
Returns the backing array. |
int |
get()
Reads the next byte of the ByteWrapper. |
void |
get(byte[] dest)
Reads dest.length bytes from the ByteWrapper into dest. |
int |
getInt()
Reads the next four byte of the ByteWrapper as a hi-endian 32-bit integer. |
int |
getPos()
Returns the current position. |
void |
put(byte[] src)
Puts a byte array in the wrapped byte array and advances the current posisiton by the size of the byte array. |
void |
put(int b)
Puts a byte in the wrapped byte array and advances the current position by 1. |
void |
putInt(int value)
Writes value to the ByteWrapper as a hi-endian 32-bit integer. |
void |
reset()
Resets current position to the start of the ByteWrapper. |
ByteWrapper |
slice()
Creates a ByteWrapper backed by the same byte array using the current position as its offset. |
ByteWrapper |
slice(int length)
Creates a ByteWrapper backed by the same byte array using the current position as its offset, and the specified length to mark the limit. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ByteWrapper(int length)
length - public ByteWrapper(byte[] buffer)
buffer -
public ByteWrapper(byte[] buffer,
int offset)
buffer - offset - | Method Detail |
|---|
public void reset()
public final int getInt()
public final int get()
public final void get(byte[] dest)
dest - public final void putInt(int value)
value - public final void put(int b)
b - Byte to put.public final void put(byte[] src)
src - Byte array to put.public final byte[] array()
public final int getPos()
public final void advance(int n)
n - public final void align(int alignment)
alignment - public final ByteWrapper slice()
public final ByteWrapper slice(int length)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||