Class CodecUtils
- java.lang.Object
-
- org.apache.cassandra.cql3.functions.types.CodecUtils
-
public final class CodecUtils extends java.lang.ObjectA set of utility methods to deal with type conversion and serialization.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.ByteBufferpack(java.nio.ByteBuffer[] buffers, int elements, ProtocolVersion version)Utility method that "packs" together a list ofByteBuffers containing serialized collection elements.static java.nio.ByteBufferreadBytes(java.nio.ByteBuffer bb, int length)Readlengthbytes frombbinto a new ByteBuffer.static java.nio.ByteBufferreadValue(java.nio.ByteBuffer input, ProtocolVersion version)Utility method that reads a value.static voidwriteValue(java.nio.ByteBuffer output, java.nio.ByteBuffer value, ProtocolVersion version)Utility method that writes a value.
-
-
-
Method Detail
-
pack
public static java.nio.ByteBuffer pack(java.nio.ByteBuffer[] buffers, int elements, ProtocolVersion version)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
public static java.nio.ByteBuffer readValue(java.nio.ByteBuffer input, ProtocolVersion version)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
public static void writeValue(java.nio.ByteBuffer output, java.nio.ByteBuffer value, ProtocolVersion version)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
public static java.nio.ByteBuffer readBytes(java.nio.ByteBuffer bb, int length)Readlengthbytes frombbinto a new ByteBuffer.- Parameters:
bb- The ByteBuffer to read.length- The number of bytes to read.- Returns:
- The read bytes.
-
-