public class IntArrayCodec extends AbstractPrimitiveArrayCodec<int[]>
list<int>
to the Java type int[]
.
Note that this codec is designed for performance and converts CQL lists directly to
int[]
, thus avoiding any unnecessary boxing and unboxing of Java primitive int
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 IntArrayCodec |
instance |
Constructor and Description |
---|
IntArrayCodec() |
Modifier and Type | Method and Description |
---|---|
protected void |
deserializeElement(ByteBuffer input,
int[] array,
int index,
ProtocolVersion protocolVersion)
Read the
index th element of array from input . |
protected void |
formatElement(StringBuilder output,
int[] array,
int index)
Format the
index th element of array to output . |
protected int[] |
newInstance(int size)
Create a new array instance with the given size.
|
protected void |
parseElement(String input,
int[] array,
int index)
Parse the
index th element of array from input . |
protected void |
serializeElement(ByteBuffer output,
int[] 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 IntArrayCodec instance
protected int sizeOfComponentType()
AbstractPrimitiveArrayCodec
sizeOfComponentType
in class AbstractPrimitiveArrayCodec<int[]>
protected void serializeElement(ByteBuffer output, int[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
to output
.serializeElement
in class AbstractPrimitiveArrayCodec<int[]>
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, int[] array, int index, ProtocolVersion protocolVersion)
AbstractPrimitiveArrayCodec
index
th element of array
from input
.deserializeElement
in class AbstractPrimitiveArrayCodec<int[]>
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, int[] array, int index)
AbstractArrayCodec
index
th element of array
to output
.formatElement
in class AbstractArrayCodec<int[]>
output
- The StringBuilder to write to.array
- The array to read from.index
- The element index.protected void parseElement(String input, int[] array, int index)
AbstractArrayCodec
index
th element of array
from input
.parseElement
in class AbstractArrayCodec<int[]>
input
- The String to read from.array
- The array to write to.index
- The element index.protected int[] newInstance(int size)
AbstractArrayCodec
newInstance
in class AbstractArrayCodec<int[]>
size
- The size of the array to instantiate.Copyright © 2012–2020. All rights reserved.