com.hazelcast.client.impl.protocol.util
Interface MutableDirectBuffer

All Superinterfaces:
DirectBuffer
All Known Subinterfaces:
AtomicBuffer
All Known Implementing Classes:
UnsafeBuffer

public interface MutableDirectBuffer
extends DirectBuffer

Abstraction over a range of buffer types that allows fields to be written (put) in native typed fashion.


Method Summary
 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, ByteBuffer srcBuffer, int length)
          Put bytes into the underlying buffer for the view.
 void putBytes(int index, 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 putDouble(int index, double value)
          Put a value to a given index.
 void putDouble(int index, double value, 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, 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, ByteOrder byteOrder)
          Put a value at a given index.
 void putLong(int index, long value)
          Put a value at a given index.
 void putLong(int index, long value, ByteOrder byteOrder)
          Put a value at a given index.
 void putShort(int index, short value)
          Put a value to a given index.
 void putShort(int index, short value, ByteOrder byteOrder)
          Put a value to a given index.
 int putStringUtf8(int offset, String value, ByteOrder byteOrder)
          Encode a String as UTF-8 bytes to the buffer with a length prefix.
 int putStringUtf8(int offset, String value, ByteOrder byteOrder, int maxEncodedSize)
          Encode a String as UTF-8 bytes the buffer with a length prefix with a maximum encoded size check.
 int putStringWithoutLengthUtf8(int offset, 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.
 
Methods inherited from interface com.hazelcast.client.impl.protocol.util.DirectBuffer
addressOffset, boundsCheck, byteArray, byteBuffer, capacity, checkLimit, getByte, getBytes, getBytes, getBytes, getBytes, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, getStringUtf8, getStringUtf8, getStringWithoutLengthUtf8, wrap, wrap, wrap, wrap, wrap, wrap, wrap
 

Method Detail

setMemory

void setMemory(int index,
               int length,
               byte value)
Set a region of memory to a given byte value.

Parameters:
index - The index at which to start the memory region.
length - The length of the run of bytes to set in the memory region.
value - The value of the byte that is set in the memory region.

putLong

void putLong(int index,
             long value,
             ByteOrder byteOrder)
Put a value at a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value to put at the given index.
byteOrder - The byteOrder of the value when written.

putLong

void putLong(int index,
             long value)
Put a value at a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putInt

void putInt(int index,
            int value,
            ByteOrder byteOrder)
Put a value at a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.
byteOrder - The byteOrder of the value when written.

putInt

void putInt(int index,
            int value)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putDouble

void putDouble(int index,
               double value,
               ByteOrder byteOrder)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.
byteOrder - The byteOrder of the value when written.

putDouble

void putDouble(int index,
               double value)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putFloat

void putFloat(int index,
              float value,
              ByteOrder byteOrder)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.
byteOrder - of the value when written.

putFloat

void putFloat(int index,
              float value)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putShort

void putShort(int index,
              short value,
              ByteOrder byteOrder)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.
byteOrder - of the value when written.

putShort

void putShort(int index,
              short value)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putByte

void putByte(int index,
             byte value)
Put a value to a given index.

Parameters:
index - The index in bytes where the value is put.
value - The value put at the given index.

putBytes

void putBytes(int index,
              byte[] src)
Put an array of src into the underlying buffer.

Parameters:
index - The index in the underlying buffer from which to start the array.
src - The array to be copied into the underlying buffer.

putBytes

void putBytes(int index,
              byte[] src,
              int offset,
              int length)
Put an array into the underlying buffer.

Parameters:
index - The index in the underlying buffer from which to start the array.
src - The array to be copied into the underlying buffer.
offset - The offset in the supplied buffer at which to begin the copy.
length - The length of the supplied buffer to copy.

putBytes

void putBytes(int index,
              ByteBuffer srcBuffer,
              int length)
Put bytes into the underlying buffer for the view. Bytes will be copied from current Buffer.position() to Buffer.limit().

Parameters:
index - The index in the underlying buffer from which to start the array.
srcBuffer - The source buffer to copy the bytes from.
length - The length of the supplied buffer to copy.

putBytes

void putBytes(int index,
              ByteBuffer srcBuffer,
              int srcIndex,
              int length)
Put bytes into the underlying buffer for the view. Bytes will be copied from the buffer index to the buffer index + length.

Parameters:
index - The index in the underlying buffer from which to start the array.
srcBuffer - The source buffer to copy the bytes from (does not change position).
srcIndex - The index in the source buffer from which the copy will begin.
length - The length in bytes to be copied.

putBytes

void putBytes(int index,
              DirectBuffer srcBuffer,
              int srcIndex,
              int length)
Put bytes from a source DirectBuffer into this MutableDirectBuffer at given indices.

Parameters:
index - The index in this buffer from which to begin putting the bytes.
srcBuffer - The source buffer from which the bytes will be copied.
srcIndex - The index in the source buffer from which the byte copy will begin.
length - The length in bytes to be copied.

putStringUtf8

int putStringUtf8(int offset,
                  String value,
                  ByteOrder byteOrder)
Encode a String as UTF-8 bytes to the buffer with a length prefix.

Parameters:
offset - The offset at which the String should be encoded.
value - The value of the String to be encoded.
byteOrder - The byteOrder for the length prefix.
Returns:
The number of bytes put to the buffer.

putStringUtf8

int putStringUtf8(int offset,
                  String value,
                  ByteOrder byteOrder,
                  int maxEncodedSize)
Encode a String as UTF-8 bytes the buffer with a length prefix with a maximum encoded size check.

Parameters:
offset - The offset at which the String should be encoded.
value - The value of the String to be encoded.
byteOrder - The byteOrder for the length prefix.
maxEncodedSize - The maximum encoded size to be checked before writing to the buffer.
Returns:
The number of bytes put to the buffer.
Throws:
IllegalArgumentException - if the encoded bytes are greater than maxEncodedSize.

putStringWithoutLengthUtf8

int putStringWithoutLengthUtf8(int offset,
                               String value)
Encode a String as UTF-8 bytes in the buffer without a length prefix.

Parameters:
offset - The offset at which the String begins.
value - The value of the String to be encoded.
Returns:
The number of bytes encoded.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.