com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib
Class FastByteBuffer

java.lang.Object
  extended by com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib.FastByteBuffer

public class FastByteBuffer
extends Object

Fast implementation of a byte buffer. Uses the little endian format.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

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

CHARSET_UTF8

protected static final Charset CHARSET_UTF8

_readOffset

protected int _readOffset
Points to the index which resulted after the last get operation.


_buffer

protected byte[] _buffer
This is the buffer on which we operate.

Constructor Detail

FastByteBuffer

protected FastByteBuffer()
Forbid instantiation.

Method Detail

getCurrentReadOffset

public int getCurrentReadOffset()
Gets the current read offset. This is increased when a get operation is performed.

Returns:
The current buffer read offset.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

seek

public void seek(int offset)
Sets the read offset to the given value.

Parameters:
offset - target offset
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

reset

public void reset()
Resets the contents of the buffer to 0.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

wrap

public static FastByteBuffer wrap(byte[] buffer)
Wraps the given array into a fast byte buffer. The array will change if operations are performed on this byte buffer.

Parameters:
buffer - The buffer which will get wrapped. null is not allowed
Returns:
The created byte buffer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

copyOf

public static FastByteBuffer copyOf(byte[] buffer,
                                    int offset,
                                    int length)
Copies the given array in a new fast byte buffer.

Parameters:
buffer - The buffer which is copied.
offset - The offset from which the copy starts.
length - The length of the bytes copied.
Returns:
The new byte buffer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

allocate

public static FastByteBuffer allocate(int size)
Allocates a new fast byte buffer with a backing array of the given size.

Parameters:
size - The size of the byte buffer. Must be positive.
Returns:
The created byte buffer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getBackingArray

public byte[] getBackingArray()
Gets a reference to the backing array of this byte buffer.

Returns:
A reference to the backing array of this byte buffer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getLong

public long getLong(int offset)
Gets the long at the given index.

Parameters:
offset - The offset where the long is located.
Returns:
The long at the specified index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getInt

public int getInt(int offset)
Gets the integer at the given index.

Parameters:
offset - The offset where the integer is located.
Returns:
The integer at the specified index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

get

public byte get(int offset)
Returns the byte at the given index.

Parameters:
offset - Position of the byte.
Returns:
The byte at the specified index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

get

public void get(byte[] destination,
                int offset)
Gets the bytes starting at the specified offset, ranging to the length of the destination.

Parameters:
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.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getString

public String getString(int offset)
Gets the string at the given index. The string at the given offset must be terminated with a \0. The string must be plain ASCII or UTF-8.

Parameters:
offset - The offset where the string is located.
Returns:
The string at the specified index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getDouble

public double getDouble(int offset)
Gets the double at the given index.

Parameters:
offset - The offset where the double is located.
Returns:
The double at the specified index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

putDouble

public int putDouble(double value,
                     int offset)
Write the given double into the byte buffer.

Parameters:
value - The value to write.
offset - The offset at which the bytes will start.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

putLong

public int putLong(long value,
                   int offset)
Write the given long into the byte buffer.

Parameters:
value - The value to write.
offset - The offset at which the bytes will start.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

putInt

public int putInt(int value,
                  int offset)
Write the given integer into the byte buffer.

Parameters:
value - The value to write.
offset - The offset at which the bytes will start.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

putString

public int putString(String value,
                     int offset)
Write the given string encoded as UTF-8 into the byte buffer. Adds the terminating 0 to the written string.

Parameters:
value - The value to write.
offset - The offset at which the bytes will start.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

put

public int put(byte[] array,
               int offset)
Copies the given array into the byte buffer, starting at the given index.

Parameters:
array - The array.
offset - The buffer offset.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

put

public 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.

Parameters:
array - The array.
offset - The buffer offset.
length - The number of bytes that should be copied into the buffer.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

put

public int put(byte value,
               int offset)
Puts the given byte into the buffet at the specified position.

Parameters:
value - The byte to put into the buffer.
offset - Position where the byte should be put.
Returns:
the count of bytes that were written to the buffer
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getLimit

public int getLimit()
Returns this buffer's limit.

Returns:
Limit of this buffer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toString

public String toString()

Overrides:
toString in class Object
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.


Copyright © 2019. All rights reserved.