public class DoubleArrayCodec extends AbstractPrimitiveArrayCodec<double[]>
list<double>
to the Java type double[]
.
Note that this codec is designed for performance and converts CQL lists
directly to double[]
, thus avoiding any unnecessary
boxing and unboxing of Java primitive double
values;
it also instantiates arrays without the need for an intermediary
Java List
object.TypeCodec.AbstractCollectionCodec<E,C extends Collection<E>>, TypeCodec.AbstractMapCodec<K,V>, TypeCodec.AbstractTupleCodec<T>, TypeCodec.AbstractUDTCodec<T>, TypeCodec.PrimitiveBooleanCodec, TypeCodec.PrimitiveByteCodec, TypeCodec.PrimitiveDoubleCodec, TypeCodec.PrimitiveFloatCodec, TypeCodec.PrimitiveIntCodec, TypeCodec.PrimitiveLongCodec, TypeCodec.PrimitiveShortCodec
Modifier and Type | Field and Description |
---|---|
static DoubleArrayCodec |
instance |
Constructor and Description |
---|
DoubleArrayCodec() |
Modifier and Type | Method and Description |
---|---|
protected void |
deserializeElement(ByteBuffer input,
double[] array,
int index,
ProtocolVersion protocolVersion)
Read the
index th element of array from input . |
protected void |
formatElement(StringBuilder output,
double[] array,
int index)
Format the
index th element of array to output . |
protected double[] |
newInstance(int size)
Create a new array instance with the given size.
|
protected void |
parseElement(String input,
double[] array,
int index)
Parse the
index th element of array from input . |
protected void |
serializeElement(ByteBuffer output,
double[] array,
int index,
ProtocolVersion protocolVersion)
Write the
index th element of array to output . |
protected int |
sizeOfComponentType()
Return the size in bytes of the array component type.
|
deserialize, serialize
format, parse
accepts, accepts, accepts, accepts, ascii, bigint, blob, cboolean, cdouble, cfloat, cint, counter, custom, date, decimal, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varint
public static final DoubleArrayCodec instance
protected int sizeOfComponentType()
AbstractPrimitiveArrayCodec
sizeOfComponentType
in class AbstractPrimitiveArrayCodec<double[]>
protected void serializeElement(ByteBuffer output, double[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
to output
.serializeElement
in class AbstractPrimitiveArrayCodec<double[]>
output
- The ByteBuffer to write to.array
- The array to read from.index
- The element index.protocolVersion
- The protocol version to use.protected void deserializeElement(ByteBuffer input, double[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
from input
.deserializeElement
in class AbstractPrimitiveArrayCodec<double[]>
input
- The ByteBuffer to read from.array
- The array to write to.index
- The element index.protocolVersion
- The protocol version to use.protected void formatElement(StringBuilder output, double[] array, int index)
AbstractArrayCodec
index
th element of array
to output
.formatElement
in class AbstractArrayCodec<double[]>
output
- The StringBuilder to write to.array
- The array to read from.index
- The element index.protected void parseElement(String input, double[] array, int index)
AbstractArrayCodec
index
th element of array
from input
.parseElement
in class AbstractArrayCodec<double[]>
input
- The String to read from.array
- The array to write to.index
- The element index.protected double[] newInstance(int size)
AbstractArrayCodec
newInstance
in class AbstractArrayCodec<double[]>
size
- The size of the array to instantiate.