public class FloatArrayCodec extends AbstractPrimitiveArrayCodec<float[]>
list<float>
to the Java type float[]
.
Note that this codec is designed for performance and converts CQL lists directly to
float[]
, thus avoiding any unnecessary boxing and unboxing of Java primitive float
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 FloatArrayCodec |
instance |
Constructor and Description |
---|
FloatArrayCodec() |
Modifier and Type | Method and Description |
---|---|
protected void |
deserializeElement(ByteBuffer input,
float[] array,
int index,
ProtocolVersion protocolVersion)
Read the
index th element of array from input . |
protected void |
formatElement(StringBuilder output,
float[] array,
int index)
Format the
index th element of array to output . |
protected float[] |
newInstance(int size)
Create a new array instance with the given size.
|
protected void |
parseElement(String input,
float[] array,
int index)
Parse the
index th element of array from input . |
protected void |
serializeElement(ByteBuffer output,
float[] 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, duration, getCqlType, getJavaType, inet, list, map, set, smallInt, time, timestamp, timeUUID, tinyInt, toString, tuple, userType, uuid, varchar, varint
public static final FloatArrayCodec instance
protected int sizeOfComponentType()
AbstractPrimitiveArrayCodec
sizeOfComponentType
in class AbstractPrimitiveArrayCodec<float[]>
protected void serializeElement(ByteBuffer output, float[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
to output
.serializeElement
in class AbstractPrimitiveArrayCodec<float[]>
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, float[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
from input
.deserializeElement
in class AbstractPrimitiveArrayCodec<float[]>
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, float[] array, int index)
AbstractArrayCodec
index
th element of array
to output
.formatElement
in class AbstractArrayCodec<float[]>
output
- The StringBuilder to write to.array
- The array to read from.index
- The element index.protected void parseElement(String input, float[] array, int index)
AbstractArrayCodec
index
th element of array
from input
.parseElement
in class AbstractArrayCodec<float[]>
input
- The String to read from.array
- The array to write to.index
- The element index.protected float[] newInstance(int size)
AbstractArrayCodec
newInstance
in class AbstractArrayCodec<float[]>
size
- The size of the array to instantiate.Copyright © 2012–2018. All rights reserved.