public class UnsafeBuffer extends java.lang.Object implements AtomicBuffer
ByteBuffer implementations.
ByteOrder of a wrapped buffer is not applied to the UnsafeBuffer; UnsafeBuffers are
stateless and can be used concurrently. To control ByteOrder use the appropriate accessor method
with the ByteOrder overload.
Note: This class has a natural ordering that is inconsistent with equals.
Types my be different but equal on buffer contents.
Note: The wrap methods on this class are not thread safe. Concurrent access should only happen after a successful wrap.| Modifier and Type | Field and Description |
|---|---|
static int |
ALIGNMENT
Buffer alignment to ensure atomic word accesses.
|
static java.lang.String |
DISABLE_BOUNDS_CHECKS_PROP_NAME |
static boolean |
SHOULD_BOUNDS_CHECK |
| Constructor and Description |
|---|
UnsafeBuffer(byte[] buffer)
Attach a view to a byte[] for providing direct access.
|
UnsafeBuffer(byte[] buffer,
int offset,
int length)
Attach a view to a byte[] for providing direct access.
|
UnsafeBuffer(java.nio.ByteBuffer buffer)
Attach a view to a
ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct. |
UnsafeBuffer(java.nio.ByteBuffer buffer,
int offset,
int length)
Attach a view to a
ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct. |
UnsafeBuffer(DirectBuffer buffer)
Attach a view to an existing
DirectBuffer |
UnsafeBuffer(DirectBuffer buffer,
int offset,
int length)
Attach a view to an existing
DirectBuffer |
UnsafeBuffer(long address,
int length)
Attach a view to an off-heap memory region by address.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addIntOrdered(int index,
int increment)
Add a value to a given index with ordered store semantics.
|
long |
addLongOrdered(int index,
long increment)
Add a value to a given index with ordered store semantics.
|
long |
addressOffset()
Reads the underlying offset to to the memory address.
|
void |
boundsCheck(int index,
int length)
Check that a given length of bytes is within the bounds from a given index.
|
byte[] |
byteArray()
Get the underlying byte[] if one exists.
|
java.nio.ByteBuffer |
byteBuffer()
Get the underlying
ByteBuffer if one exists. |
int |
capacity()
Get the capacity of the underlying buffer.
|
void |
checkLimit(int limit)
Check that a given limit is not greater than the capacity of a buffer from a given offset.
|
boolean |
compareAndSetInt(int index,
int expectedValue,
int updateValue)
Atomic compare and set of a int given an expected value.
|
boolean |
compareAndSetLong(int index,
long expectedValue,
long updateValue)
Atomic compare and set of a long given an expected value.
|
int |
compareTo(DirectBuffer that) |
boolean |
equals(java.lang.Object obj) |
int |
getAndAddInt(int index,
int delta)
Atomically add a delta to a value at a location returning the previous contents.
|
long |
getAndAddLong(int index,
long delta)
Atomically add a delta to a value at a location returning the previous contents.
|
int |
getAndSetInt(int index,
int value)
Atomically exchange a value at a location returning the previous contents.
|
long |
getAndSetLong(int index,
long value)
Atomically exchange a value at a location returning the previous contents.
|
byte |
getByte(int index)
Get the value at a given index.
|
void |
getBytes(int index,
byte[] dst)
Get from the underlying buffer into a supplied byte array.
|
void |
getBytes(int index,
byte[] dst,
int offset,
int length)
Get bytes from the underlying buffer into a supplied byte array.
|
void |
getBytes(int index,
java.nio.ByteBuffer dstBuffer,
int length)
Get from the underlying buffer into a supplied
ByteBuffer current Buffer.position(). |
void |
getBytes(int index,
java.nio.ByteBuffer dstBuffer,
int dstOffset,
int length)
Get from the underlying buffer into a supplied
ByteBuffer at a offset. |
void |
getBytes(int index,
MutableDirectBuffer dstBuffer,
int dstIndex,
int length)
Get bytes from this
DirectBuffer into the provided MutableDirectBuffer at given indices. |
byte |
getByteVolatile(int index)
Get the value at a given index with volatile semantics.
|
char |
getChar(int index)
Get the value at a given index.
|
char |
getChar(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
char |
getCharVolatile(int index)
Get the value at a given index with volatile semantics.
|
double |
getDouble(int index)
Get the value at a given index.
|
double |
getDouble(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
float |
getFloat(int index)
Get the value at a given index.
|
float |
getFloat(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
int |
getInt(int index)
Get the value at a given index.
|
int |
getInt(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
int |
getIntVolatile(int index)
Get the value at a given index with volatile semantics.
|
long |
getLong(int index)
Get the value at a given index.
|
long |
getLong(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
long |
getLongVolatile(int index)
Get the value at a given index with volatile semantics.
|
short |
getShort(int index)
Get the value at a given index.
|
short |
getShort(int index,
java.nio.ByteOrder byteOrder)
Get the value at a given index.
|
short |
getShortVolatile(int index)
Get the value at a given index with volatile semantics.
|
java.lang.String |
getStringUtf8(int index)
Get a String from bytes encoded in UTF-8 format that is length prefixed.
|
java.lang.String |
getStringUtf8(int index,
java.nio.ByteOrder byteOrder)
Get a String from bytes encoded in UTF-8 format that is length prefixed.
|
java.lang.String |
getStringUtf8(int index,
int length)
Get part of String from bytes encoded in UTF-8 format that is length prefixed.
|
java.lang.String |
getStringWithoutLengthUtf8(int index,
int length)
Get an encoded UTF-8 String from the buffer that does not have a length prefix.
|
int |
hashCode() |
boolean |
isExpandable()
Is this buffer expandable to accommodate putting data into it beyond the current capacity?
|
void |
putByte(int index,
byte value)
Put a value to a given index.
|
void |
putBytes(int index,
byte[] src)
Put an array of src into the underlying buffer.
|
void |
putBytes(int index,
byte[] src,
int offset,
int length)
Put an array into the underlying buffer.
|
void |
putBytes(int index,
java.nio.ByteBuffer srcBuffer,
int length)
Put bytes into the underlying buffer for the view.
|
void |
putBytes(int index,
java.nio.ByteBuffer srcBuffer,
int srcIndex,
int length)
Put bytes into the underlying buffer for the view.
|
void |
putBytes(int index,
DirectBuffer srcBuffer,
int srcIndex,
int length)
Put bytes from a source
DirectBuffer into this MutableDirectBuffer at given indices. |
void |
putByteVolatile(int index,
byte value)
Put a value to a given index with volatile semantics.
|
void |
putChar(int index,
char value)
Put a value to a given index.
|
void |
putChar(int index,
char value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putCharVolatile(int index,
char value)
Put a value to a given index with volatile semantics.
|
void |
putDouble(int index,
double value)
Put a value to a given index.
|
void |
putDouble(int index,
double value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putFloat(int index,
float value)
Put a value to a given index.
|
void |
putFloat(int index,
float value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putInt(int index,
int value)
Put a value to a given index.
|
void |
putInt(int index,
int value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putIntOrdered(int index,
int value)
Put a value to a given index with ordered semantics.
|
void |
putIntVolatile(int index,
int value)
Put a value to a given index with volatile semantics.
|
void |
putLong(int index,
long value)
Put a value to a given index.
|
void |
putLong(int index,
long value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putLongOrdered(int index,
long value)
Put a value to a given index with ordered store semantics.
|
void |
putLongVolatile(int index,
long value)
Put a value to a given index with volatile semantics.
|
void |
putShort(int index,
short value)
Put a value to a given index.
|
void |
putShort(int index,
short value,
java.nio.ByteOrder byteOrder)
Put a value to a given index.
|
void |
putShortVolatile(int index,
short value)
Put a value to a given index with volatile semantics.
|
int |
putStringUtf8(int index,
java.lang.String value)
Encode a String as UTF-8 bytes to the buffer with a length prefix.
|
int |
putStringUtf8(int index,
java.lang.String value,
java.nio.ByteOrder byteOrder)
Encode a String as UTF-8 bytes to the buffer with a length prefix.
|
int |
putStringUtf8(int index,
java.lang.String value,
java.nio.ByteOrder byteOrder,
int maxEncodedSize)
Encode a String as UTF-8 bytes the buffer with a length prefix with a maximum encoded size check.
|
int |
putStringUtf8(int index,
java.lang.String value,
int maxEncodedSize)
Encode a String as UTF-8 bytes the buffer with a length prefix with a maximum encoded size check.
|
int |
putStringWithoutLengthUtf8(int index,
java.lang.String value)
Encode a String as UTF-8 bytes in the buffer without a length prefix.
|
void |
setMemory(int index,
int length,
byte value)
Set a region of memory to a given byte value.
|
void |
verifyAlignment()
Verify that the underlying buffer is correctly aligned to prevent word tearing and other ordering issues.
|
void |
wrap(byte[] buffer)
Attach a view to a byte[] for providing direct access.
|
void |
wrap(byte[] buffer,
int offset,
int length)
Attach a view to a byte[] for providing direct access.
|
void |
wrap(java.nio.ByteBuffer buffer)
Attach a view to a
ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct. |
void |
wrap(java.nio.ByteBuffer buffer,
int offset,
int length)
Attach a view to a
ByteBuffer for providing direct access. |
void |
wrap(DirectBuffer buffer)
Attach a view to an existing
DirectBuffer |
void |
wrap(DirectBuffer buffer,
int offset,
int length)
Attach a view to a
DirectBuffer for providing direct access. |
void |
wrap(long address,
int length)
Attach a view to an off-heap memory region by address.
|
public static final int ALIGNMENT
public static final java.lang.String DISABLE_BOUNDS_CHECKS_PROP_NAME
public static final boolean SHOULD_BOUNDS_CHECK
public UnsafeBuffer(byte[] buffer)
buffer - to which the view is attached.public UnsafeBuffer(byte[] buffer,
int offset,
int length)
buffer - to which the view is attached.offset - within the buffer to begin.length - of the buffer to be included.public UnsafeBuffer(java.nio.ByteBuffer buffer)
ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct.buffer - to which the view is attached.public UnsafeBuffer(java.nio.ByteBuffer buffer,
int offset,
int length)
ByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct.buffer - to which the view is attached.offset - within the buffer to begin.length - of the buffer to be included.public UnsafeBuffer(DirectBuffer buffer)
DirectBufferbuffer - to which the view is attached.public UnsafeBuffer(DirectBuffer buffer, int offset, int length)
DirectBufferbuffer - to which the view is attached.offset - within the buffer to begin.length - of the buffer to be included.public UnsafeBuffer(long address,
int length)
address - where the memory begins off-heaplength - of the buffer from the given addresspublic void wrap(byte[] buffer)
DirectBufferwrap in interface DirectBufferbuffer - to which the view is attached.public void wrap(byte[] buffer,
int offset,
int length)
DirectBufferwrap in interface DirectBufferbuffer - to which the view is attached.offset - at which the view begins.length - of the buffer included in the viewpublic void wrap(java.nio.ByteBuffer buffer)
DirectBufferByteBuffer for providing direct access, the ByteBuffer can be
heap based or direct.wrap in interface DirectBufferbuffer - to which the view is attached.public void wrap(java.nio.ByteBuffer buffer,
int offset,
int length)
DirectBufferByteBuffer for providing direct access.wrap in interface DirectBufferbuffer - to which the view is attached.offset - at which the view begins.length - of the buffer included in the viewpublic void wrap(DirectBuffer buffer)
DirectBufferDirectBufferwrap in interface DirectBufferbuffer - to which the view is attached.public void wrap(DirectBuffer buffer, int offset, int length)
DirectBufferDirectBuffer for providing direct access.wrap in interface DirectBufferbuffer - to which the view is attached.offset - at which the view begins.length - of the buffer included in the viewpublic void wrap(long address,
int length)
DirectBufferwrap in interface DirectBufferaddress - where the memory begins off-heaplength - of the buffer from the given addresspublic long addressOffset()
DirectBufferaddressOffset in interface DirectBufferpublic byte[] byteArray()
DirectBufferbyteArray in interface DirectBufferpublic java.nio.ByteBuffer byteBuffer()
DirectBufferByteBuffer if one exists.byteBuffer in interface DirectBufferByteBuffer if one exists.public void setMemory(int index,
int length,
byte value)
MutableDirectBuffersetMemory in interface MutableDirectBufferindex - at which to start.length - of the run of bytes to set.value - the memory will be set to.public int capacity()
DirectBuffercapacity in interface DirectBufferpublic void checkLimit(int limit)
DirectBufferCan be overridden in a DirectBuffer subclass to enable an extensible buffer or handle retry after a flush.
checkLimit in interface DirectBufferlimit - up to which access is required.public boolean isExpandable()
MutableDirectBufferisExpandable in interface MutableDirectBufferpublic void verifyAlignment()
AtomicBufferverifyAlignment in interface AtomicBufferpublic long getLong(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetLong in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putLong(int index,
long value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputLong in interface MutableDirectBufferindex - in bytes for where to put.value - for at a given indexbyteOrder - of the value when writtenpublic long getLong(int index)
DirectBuffergetLong in interface DirectBufferindex - in bytes from which to get.public void putLong(int index,
long value)
MutableDirectBufferputLong in interface MutableDirectBufferindex - in bytes for where to put.value - for at a given indexpublic long getLongVolatile(int index)
AtomicBuffergetLongVolatile in interface AtomicBufferindex - in bytes from which to get.public void putLongVolatile(int index,
long value)
AtomicBufferputLongVolatile in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic void putLongOrdered(int index,
long value)
AtomicBufferputLongOrdered in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic long addLongOrdered(int index,
long increment)
AtomicBufferaddLongOrdered in interface AtomicBufferindex - in bytes for where to put.increment - by which the value at the index will be adjusted.public boolean compareAndSetLong(int index,
long expectedValue,
long updateValue)
AtomicBuffercompareAndSetLong in interface AtomicBufferindex - in bytes for where to put.expectedValue - at to be comparedupdateValue - to be exchangedpublic long getAndSetLong(int index,
long value)
AtomicBuffergetAndSetLong in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic long getAndAddLong(int index,
long delta)
AtomicBuffergetAndAddLong in interface AtomicBufferindex - in bytes for where to put.delta - to be added to the value at the indexpublic int getInt(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetInt in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putInt(int index,
int value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputInt in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenbyteOrder - of the value when writtenpublic int getInt(int index)
DirectBuffergetInt in interface DirectBufferindex - in bytes from which to get.public void putInt(int index,
int value)
MutableDirectBufferputInt in interface MutableDirectBufferindex - in bytes for where to put.value - for at a given indexpublic int getIntVolatile(int index)
AtomicBuffergetIntVolatile in interface AtomicBufferindex - in bytes from which to get.public void putIntVolatile(int index,
int value)
AtomicBufferputIntVolatile in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic void putIntOrdered(int index,
int value)
AtomicBufferputIntOrdered in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic int addIntOrdered(int index,
int increment)
AtomicBufferaddIntOrdered in interface AtomicBufferindex - in bytes for where to put.increment - by which the value at the index will be adjusted.public boolean compareAndSetInt(int index,
int expectedValue,
int updateValue)
AtomicBuffercompareAndSetInt in interface AtomicBufferindex - in bytes for where to put.expectedValue - at to be comparedupdateValue - to be exchangedpublic int getAndSetInt(int index,
int value)
AtomicBuffergetAndSetInt in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic int getAndAddInt(int index,
int delta)
AtomicBuffergetAndAddInt in interface AtomicBufferindex - in bytes for where to put.delta - to be added to the value at the indexpublic double getDouble(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetDouble in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putDouble(int index,
double value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputDouble in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenbyteOrder - of the value when written.public double getDouble(int index)
DirectBuffergetDouble in interface DirectBufferindex - in bytes from which to get.public void putDouble(int index,
double value)
MutableDirectBufferputDouble in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenpublic float getFloat(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetFloat in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putFloat(int index,
float value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputFloat in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenbyteOrder - of the value when written.public float getFloat(int index)
DirectBuffergetFloat in interface DirectBufferindex - in bytes from which to get.public void putFloat(int index,
float value)
MutableDirectBufferputFloat in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenpublic short getShort(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetShort in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putShort(int index,
short value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputShort in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenbyteOrder - of the value when written.public short getShort(int index)
DirectBuffergetShort in interface DirectBufferindex - in bytes from which to get.public void putShort(int index,
short value)
MutableDirectBufferputShort in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenpublic short getShortVolatile(int index)
AtomicBuffergetShortVolatile in interface AtomicBufferindex - in bytes from which to get.public void putShortVolatile(int index,
short value)
AtomicBufferputShortVolatile in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic byte getByte(int index)
DirectBuffergetByte in interface DirectBufferindex - in bytes from which to get.public void putByte(int index,
byte value)
MutableDirectBufferputByte in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenpublic byte getByteVolatile(int index)
AtomicBuffergetByteVolatile in interface AtomicBufferindex - in bytes from which to get.public void putByteVolatile(int index,
byte value)
AtomicBufferputByteVolatile in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic void getBytes(int index,
byte[] dst)
DirectBuffergetBytes in interface DirectBufferindex - in the underlying buffer to start from.dst - into which the dst will be copied.public void getBytes(int index,
byte[] dst,
int offset,
int length)
DirectBuffergetBytes in interface DirectBufferindex - in the underlying buffer to start from.dst - into which the bytes will be copied.offset - in the supplied buffer to start the copylength - of the supplied buffer to use.public void getBytes(int index,
MutableDirectBuffer dstBuffer,
int dstIndex,
int length)
DirectBufferDirectBuffer into the provided MutableDirectBuffer at given indices.getBytes in interface DirectBufferindex - in this buffer to begin getting the bytes.dstBuffer - to which the bytes will be copied.dstIndex - in the channel buffer to which the byte copy will begin.length - of the bytes to be copied.public void getBytes(int index,
java.nio.ByteBuffer dstBuffer,
int length)
DirectBufferByteBuffer current Buffer.position().
The destination buffer will have its Buffer.position() advanced as a result.getBytes in interface DirectBufferindex - in the underlying buffer to start from.dstBuffer - into which the bytes will be copied.length - of the supplied buffer to use.public void getBytes(int index,
java.nio.ByteBuffer dstBuffer,
int dstOffset,
int length)
DirectBufferByteBuffer at a offset.
The destination buffer will not have its Buffer.position() advanced as a result.getBytes in interface DirectBufferindex - in the underlying buffer to start from.dstBuffer - into which the bytes will be copied.dstOffset - in the target buffer.length - of the supplied buffer to use.public void putBytes(int index,
byte[] src)
MutableDirectBufferputBytes in interface MutableDirectBufferindex - in the underlying buffer to start from.src - to be copied to the underlying buffer.public void putBytes(int index,
byte[] src,
int offset,
int length)
MutableDirectBufferputBytes in interface MutableDirectBufferindex - in the underlying buffer to start from.src - to be copied to the underlying buffer.offset - in the supplied buffer to begin the copy.length - of the supplied buffer to copy.public void putBytes(int index,
java.nio.ByteBuffer srcBuffer,
int length)
MutableDirectBufferBuffer.position() for a given length.
The source buffer will have its Buffer.position() advanced as a result.putBytes in interface MutableDirectBufferindex - in the underlying buffer to start from.srcBuffer - to copy the bytes from.length - of the supplied buffer to copy.public void putBytes(int index,
java.nio.ByteBuffer srcBuffer,
int srcIndex,
int length)
MutableDirectBufferBuffer.position() advanced as a result.putBytes in interface MutableDirectBufferindex - in the underlying buffer to start from.srcBuffer - to copy the bytes from (does not change position).srcIndex - in the source buffer from which the copy will begin.length - of the bytes to be copied.public void putBytes(int index,
DirectBuffer srcBuffer,
int srcIndex,
int length)
MutableDirectBufferDirectBuffer into this MutableDirectBuffer at given indices.putBytes in interface MutableDirectBufferindex - in this buffer to begin putting the bytes.srcBuffer - from which the bytes will be copied.srcIndex - in the source buffer from which the byte copy will begin.length - of the bytes to be copied.public char getChar(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetChar in interface DirectBufferindex - in bytes from which to get.byteOrder - of the value to be read.public void putChar(int index,
char value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputChar in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenbyteOrder - of the value when written.public char getChar(int index)
DirectBuffergetChar in interface DirectBufferindex - in bytes from which to get.public void putChar(int index,
char value)
MutableDirectBufferputChar in interface MutableDirectBufferindex - in bytes for where to put.value - to be writtenpublic char getCharVolatile(int index)
AtomicBuffergetCharVolatile in interface AtomicBufferindex - in bytes from which to get.public void putCharVolatile(int index,
char value)
AtomicBufferputCharVolatile in interface AtomicBufferindex - in bytes for where to put.value - for at a given indexpublic java.lang.String getStringUtf8(int index)
DirectBuffergetStringUtf8 in interface DirectBufferindex - at which the String begins.public java.lang.String getStringUtf8(int index,
java.nio.ByteOrder byteOrder)
DirectBuffergetStringUtf8 in interface DirectBufferindex - at which the String begins.byteOrder - for the length at the beginning of the String.public java.lang.String getStringUtf8(int index,
int length)
DirectBuffergetStringUtf8 in interface DirectBufferindex - at which the String begins.length - of the String in bytes to decode.public int putStringUtf8(int index,
java.lang.String value)
MutableDirectBufferputStringUtf8 in interface MutableDirectBufferindex - at which the String should be encoded.value - of the String to be encoded.public int putStringUtf8(int index,
java.lang.String value,
java.nio.ByteOrder byteOrder)
MutableDirectBufferputStringUtf8 in interface MutableDirectBufferindex - at which the String should be encoded.value - of the String to be encoded.byteOrder - for the length prefix.public int putStringUtf8(int index,
java.lang.String value,
int maxEncodedSize)
MutableDirectBufferputStringUtf8 in interface MutableDirectBufferindex - at which the String should be encoded.value - of the String to be encoded.maxEncodedSize - to be checked before writing to the buffer.public int putStringUtf8(int index,
java.lang.String value,
java.nio.ByteOrder byteOrder,
int maxEncodedSize)
MutableDirectBufferputStringUtf8 in interface MutableDirectBufferindex - at which the String should be encoded.value - of the String to be encoded.byteOrder - for the length prefix.maxEncodedSize - to be checked before writing to the buffer.public java.lang.String getStringWithoutLengthUtf8(int index,
int length)
DirectBuffergetStringWithoutLengthUtf8 in interface DirectBufferindex - at which the String begins.length - of the String in bytes to decode.public int putStringWithoutLengthUtf8(int index,
java.lang.String value)
MutableDirectBufferputStringWithoutLengthUtf8 in interface MutableDirectBufferindex - at which the String begins.value - of the String to be encoded.public void boundsCheck(int index,
int length)
DirectBufferboundsCheck in interface DirectBufferindex - from which to check.length - in bytes of the range to check.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(DirectBuffer that)
compareTo in interface java.lang.Comparable<DirectBuffer>Copyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.