public interface ClientProtocolBuffer
SafeBuffer
and UnsafeBuffer
Modifier and Type | Method and Description |
---|---|
byte[] |
byteArray()
Get the underlying byte[] if one exists.
|
int |
capacity()
Get the capacity of the underlying buffer.
|
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.
|
int |
getInt(int index)
Get the value at a given index.
|
long |
getLong(int index)
Get the value at a given index.
|
short |
getShort(int index)
Get the value at a given index.
|
String |
getStringUtf8(int offset,
int length)
Get part of String from bytes encoded in UTF-8 format without a length prefix.
|
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 src,
int length) |
void |
putInt(int index,
int value)
Put a value at a given index.
|
void |
putLong(int index,
long value)
Put a value at a given index.
|
void |
putShort(int index,
short value)
Put a value to a given index.
|
int |
putStringUtf8(int index,
String value)
Encode a String as UTF-8 bytes to the buffer with a length prefix.
|
int |
putStringUtf8(int index,
String value,
int maxEncodedSize)
Encode a String as UTF-8 bytes the buffer with a length prefix with a maximum encoded size check.
|
void |
wrap(byte[] buffer)
Attach a view to a byte[] for providing direct access.
|
void wrap(byte[] buffer)
buffer
- to which the view is attached.byte[] byteArray()
int capacity()
long getLong(int index)
index
- in bytes from which to get.int getInt(int index)
index
- in bytes from which to get.short getShort(int index)
index
- in bytes from which to get.byte getByte(int index)
index
- in bytes from which to get.void getBytes(int index, byte[] dst)
index
- in the underlying buffer to start from.dst
- into which the dst will be copied.void getBytes(int index, byte[] dst, int offset, int length)
index
- 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.String getStringUtf8(int offset, int length)
offset
- at which the String begins.length
- of the String in bytes to decode.void putLong(int index, long value)
index
- The index in bytes where the value is put.value
- The value to put at the given index.void putInt(int index, int value)
index
- The index in bytes where the value is put.value
- The value put at the given index.void putShort(int index, short value)
index
- The index in bytes where the value is put.value
- The value put at the given index.void putByte(int index, byte value)
index
- The index in bytes where the value is put.value
- The value put at the given index.void putBytes(int index, byte[] src)
index
- The index in the underlying buffer from which to start the array.src
- The array to be copied into the underlying buffer.void putBytes(int index, byte[] src, int offset, int length)
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.void putBytes(int index, ByteBuffer src, int length)
int putStringUtf8(int index, String value)
index
- The index at which the String should be encoded.value
- The value of the String to be encoded.int putStringUtf8(int index, String value, int maxEncodedSize)
index
- The index at which the String should be encoded.value
- The value of the String to be encoded.maxEncodedSize
- The maximum encoded size to be checked before writing to the buffer.IllegalArgumentException
- if the encoded bytes are greater than maxEncodedSize.Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.