|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.controllerModel.sunrise.connectionLib.FastByteBuffer
public class FastByteBuffer
Fast implementation of a byte buffer. Uses the little endian format.
| Field Summary | |
|---|---|
protected byte[] |
_buffer
This is the buffer on which we operate. |
protected int |
_readOffset
Points to the index which resulted after the last get operation. |
protected static Charset |
CHARSET_UTF8
|
| Constructor Summary | |
|---|---|
protected |
FastByteBuffer()
Forbid instantiation. |
| Method Summary | |
|---|---|
static FastByteBuffer |
allocate(int size)
Allocates a new fast byte buffer with a backing array of the given size. |
static FastByteBuffer |
copyOf(byte[] buffer,
int offset,
int length)
Copies the given array in a new fast byte buffer. |
void |
get(byte[] destination,
int offset)
Gets the bytes starting at the specified offset, ranging to the length of the destination. |
byte |
get(int offset)
Returns the byte at the given index. |
byte[] |
getBackingArray()
Gets a reference to the backing array of this byte buffer. |
int |
getCurrentReadOffset()
Gets the current read offset. |
double |
getDouble(int offset)
Gets the double at the given index. |
int |
getInt(int offset)
Gets the integer at the given index. |
int |
getLimit()
Returns this buffer's limit. |
long |
getLong(int offset)
Gets the long at the given index. |
String |
getString(int offset)
Gets the string at the given index. |
int |
put(byte[] array,
int offset)
Copies the given array into the byte buffer, starting at the given index. |
int |
put(byte[] array,
int offset,
int length)
Copies the specified number of bytes from the given array into the byte buffer, starting at the given index. |
int |
put(byte value,
int offset)
Puts the given byte into the buffet at the specified position. |
int |
putDouble(double value,
int offset)
Write the given double into the byte buffer. |
int |
putInt(int value,
int offset)
Write the given integer into the byte buffer. |
int |
putLong(long value,
int offset)
Write the given long into the byte buffer. |
int |
putString(String value,
int offset)
Write the given string encoded as UTF-8 into the byte buffer. |
void |
reset()
Resets the contents of the buffer to 0. |
void |
seek(int offset)
Sets the read offset to the given value. |
String |
toString()
|
static FastByteBuffer |
wrap(byte[] buffer)
Wraps the given array into a fast byte buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Charset CHARSET_UTF8
protected int _readOffset
protected byte[] _buffer
| Constructor Detail |
|---|
protected FastByteBuffer()
| Method Detail |
|---|
public int getCurrentReadOffset()
public void seek(int offset)
offset - target offsetpublic void reset()
public static FastByteBuffer wrap(byte[] buffer)
buffer - The buffer which will get wrapped. null is not
allowed
public static FastByteBuffer copyOf(byte[] buffer,
int offset,
int length)
buffer - The buffer which is copied.offset - The offset from which the copy starts.length - The length of the bytes copied.
public static FastByteBuffer allocate(int size)
size - The size of the byte buffer. Must be positive.
public byte[] getBackingArray()
public long getLong(int offset)
offset - The offset where the long is located.
public int getInt(int offset)
offset - The offset where the integer is located.
public byte get(int offset)
offset - Position of the byte.
public void get(byte[] destination,
int offset)
destination - The destination array into which the bytes will get copied.offset - The offset in the byte buffer at which we should start the
copy process.public String getString(int offset)
offset - The offset where the string is located.
public double getDouble(int offset)
offset - The offset where the double is located.
public int putDouble(double value,
int offset)
value - The value to write.offset - The offset at which the bytes will start.
public int putLong(long value,
int offset)
value - The value to write.offset - The offset at which the bytes will start.
public int putInt(int value,
int offset)
value - The value to write.offset - The offset at which the bytes will start.
public int putString(String value,
int offset)
value - The value to write.offset - The offset at which the bytes will start.
public int put(byte[] array,
int offset)
array - The array.offset - The buffer offset.
public int put(byte[] array,
int offset,
int length)
array - The array.offset - The buffer offset.length - The number of bytes that should be copied into the buffer.
public int put(byte value,
int offset)
value - The byte to put into the buffer.offset - Position where the byte should be put.
public int getLimit()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||