Class CodecUtils
java.lang.Object
org.apache.cassandra.cql3.functions.types.CodecUtils
A set of utility methods to deal with type conversion and serialization.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferpack(ByteBuffer[] buffers, int elements, ProtocolVersion version) Utility method that "packs" together a list ofByteBuffers containing serialized collection elements.static ByteBufferreadBytes(ByteBuffer bb, int length) Readlengthbytes frombbinto a new ByteBuffer.static ByteBufferreadValue(ByteBuffer input, ProtocolVersion version) Utility method that reads a value.static voidwriteValue(ByteBuffer output, ByteBuffer value, ProtocolVersion version) Utility method that writes a value.
-
Method Details
-
pack
Utility method that "packs" together a list ofByteBuffers containing serialized collection elements. Mainly intended for use with collection codecs when serializing collections.- Parameters:
buffers- the collection elementselements- the total number of elementsversion- the protocol version to use- Returns:
- The serialized collection
-
readValue
Utility method that reads a value. Mainly intended for collection codecs when deserializing CQL collections.- Parameters:
input- The ByteBuffer to read from.version- The protocol version to use.- Returns:
- The collection element.
-
writeValue
Utility method that writes a value. Mainly intended for collection codecs when deserializing CQL collections.- Parameters:
output- The ByteBuffer to write to.value- The value to write.version- The protocol version to use.
-
readBytes
Readlengthbytes frombbinto a new ByteBuffer.- Parameters:
bb- The ByteBuffer to read.length- The number of bytes to read.- Returns:
- The read bytes.
-