public final class CodecUtils extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static int | fromCqlDateToDaysSinceEpoch(long raw)Convert from a raw CQL long representing a numeric DATE literal
 to the number of days since the Epoch. | 
| static long | fromDaysSinceEpochToCqlDate(int days)Convert the number of days since the Epoch into
 a raw CQL long representing a numeric DATE literal. | 
| static int | fromSignedToUnsignedInt(int signed)Converts an int into an "unsigned" int suitable to be written as a DATE value. | 
| static int | fromUnsignedToSignedInt(int unsigned)Converts an "unsigned" int read from a DATE value into a signed int. | 
| static ByteBuffer | pack(ByteBuffer[] buffers,
    int elements,
    ProtocolVersion version)Utility method that "packs" together a list of  ByteBuffers containing
 serialized collection elements. | 
| static ByteBuffer | readBytes(ByteBuffer bb,
         int length)Read  lengthbytes frombbinto a new ByteBuffer. | 
| static int | readSize(ByteBuffer input,
        ProtocolVersion version)Utility method that reads a size value. | 
| static ByteBuffer | readValue(ByteBuffer input,
         ProtocolVersion version)Utility method that reads a value. | 
| static void | writeSize(ByteBuffer output,
         int size,
         ProtocolVersion version)Utility method that writes a size value. | 
| static void | writeValue(ByteBuffer output,
          ByteBuffer value,
          ProtocolVersion version)Utility method that writes a value. | 
public static ByteBuffer pack(ByteBuffer[] buffers, int elements, ProtocolVersion version)
ByteBuffers 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 int readSize(ByteBuffer input, ProtocolVersion version)
input - The ByteBuffer to read from.version - The protocol version to use.public static void writeSize(ByteBuffer output, int size, ProtocolVersion version)
output - The ByteBuffer to write to.size - The collection size.version - The protocol version to use.public static ByteBuffer readValue(ByteBuffer input, ProtocolVersion version)
input - The ByteBuffer to read from.version - The protocol version to use.public static void writeValue(ByteBuffer output, ByteBuffer value, ProtocolVersion version)
output - The ByteBuffer to write to.value - The value to write.version - The protocol version to use.public static ByteBuffer readBytes(ByteBuffer bb, int length)
length bytes from bb into a new ByteBuffer.bb - The ByteBuffer to read.length - The number of bytes to read.public static int fromUnsignedToSignedInt(int unsigned)
public static int fromSignedToUnsignedInt(int signed)
public static int fromCqlDateToDaysSinceEpoch(long raw)
raw - The CQL date value to convert.IllegalArgumentException - if the value is out of range.public static long fromDaysSinceEpochToCqlDate(int days)
days - The number of days since the Epoch convert.Copyright © 2012–2017. All rights reserved.