|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.esotericsoftware.kryo.Serializer
com.esotericsoftware.kryo.serialize.ArraySerializer
public class ArraySerializer
Serializes arrays.
With the default constructor, an array requires a header of 2-4 bytes plus 2 bytes for each dimension beyond the first. If the array type is not final then an extra byte is written for each element.
Kryo.register(Class, Serializer)| Constructor Summary | |
|---|---|
ArraySerializer(Kryo kryo)
|
|
| Method Summary | ||
|---|---|---|
static int |
getDimensionCount(java.lang.Class arrayClass)
|
|
static int[] |
getDimensions(java.lang.Object array)
|
|
static java.lang.Class |
getElementClass(java.lang.Class arrayClass)
|
|
|
readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class<T> type)
Reads an object from the buffer. |
|
void |
setDimensionCount(java.lang.Integer dimensions)
|
|
void |
setElementsAreSameType(boolean elementsAreSameType)
|
|
void |
setElementsCanBeNull(boolean elementsCanBeNull)
|
|
void |
setLength(int length)
Identical to calling setLengths(int[]) with: new int[] {length} |
|
void |
setLengths(int[] lengths)
Sets both the number of dimensions and the lengths of each. |
|
void |
writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object array)
Writes the object to the buffer. |
|
| Methods inherited from class com.esotericsoftware.kryo.Serializer |
|---|
isFinal, newInstance, readObject, setCanBeNull, writeObject |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArraySerializer(Kryo kryo)
| Method Detail |
|---|
public void setDimensionCount(java.lang.Integer dimensions)
dimensions - The number of dimensions. Saves 1 byte. Set to null to determine the number of dimensions (default).public void setLength(int length)
setLengths(int[]) with: new int[] {length}
public void setLengths(int[] lengths)
public void setElementsCanBeNull(boolean elementsCanBeNull)
elementsCanBeNull - False if all elements are not null. This saves 1 byte per element if the array type is final or
elementsAreSameClassAsType is true. True if it is not known (default).public void setElementsAreSameType(boolean elementsAreSameType)
elementsAreSameType - True if all elements are the same type as the array (ie they don't extend the array type). This
saves 1 byte per element if the array type is not final. Set to false if the array type is final or elements
extend the array type (default).
public void writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object array)
Serializer
writeObjectData in class Serializerarray - Cannot be null.
public <T> T readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class<T> type)
Serializer
readObjectData in class Serializerpublic static int getDimensionCount(java.lang.Class arrayClass)
public static int[] getDimensions(java.lang.Object array)
public static java.lang.Class getElementClass(java.lang.Class arrayClass)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||