public final class CodecUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer |
pack(java.nio.ByteBuffer[] buffers,
int elements,
ProtocolVersion version)
Utility method that "packs" together a list of
ByteBuffer s containing serialized
collection elements. |
static java.nio.ByteBuffer |
readBytes(java.nio.ByteBuffer bb,
int length)
Read
length bytes from bb into a new ByteBuffer. |
static java.nio.ByteBuffer |
readValue(java.nio.ByteBuffer input,
ProtocolVersion version)
Utility method that reads a value.
|
static void |
writeValue(java.nio.ByteBuffer output,
java.nio.ByteBuffer value,
ProtocolVersion version)
Utility method that writes a value.
|
public static java.nio.ByteBuffer pack(java.nio.ByteBuffer[] buffers, int elements, ProtocolVersion version)
ByteBuffer
s containing serialized
collection elements. Mainly intended for use with collection codecs when serializing
collections.buffers
- the collection elementselements
- the total number of elementsversion
- the protocol version to usepublic static java.nio.ByteBuffer readValue(java.nio.ByteBuffer input, ProtocolVersion version)
input
- The ByteBuffer to read from.version
- The protocol version to use.public static void writeValue(java.nio.ByteBuffer output, java.nio.ByteBuffer value, ProtocolVersion version)
output
- The ByteBuffer to write to.value
- The value to write.version
- The protocol version to use.public static java.nio.ByteBuffer readBytes(java.nio.ByteBuffer bb, int length)
length
bytes from bb
into a new ByteBuffer.bb
- The ByteBuffer to read.length
- The number of bytes to read.Copyright © 2009-2022 The Apache Software Foundation