|
||||||||||
| 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.IntSerializer
public class IntSerializer
Writes a 1-5 byte integer.
| Constructor Summary | |
|---|---|
IntSerializer()
|
|
IntSerializer(boolean optimizePositive)
|
|
| Method Summary | |
|---|---|
static boolean |
canRead(java.nio.ByteBuffer buffer,
boolean optimizePositive)
Reads true if the buffer contains enough data to read an int that was written with put(ByteBuffer, int, boolean). |
static int |
get(java.nio.ByteBuffer buffer,
boolean optimizePositive)
Reads an int from the buffer that was written with put(ByteBuffer, int, boolean). |
static int |
length(int value,
boolean optimizePositive)
Reads true if the buffer contains enough data to read an int that was written with put(ByteBuffer, int, boolean). |
static int |
put(java.nio.ByteBuffer buffer,
int value,
boolean optimizePositive)
Writes the specified int to the buffer using 1 to 5 bytes, depending on the size of the number. |
java.lang.Integer |
readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class type)
Reads an object from the buffer. |
void |
writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object object)
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 IntSerializer()
public IntSerializer(boolean optimizePositive)
optimizePositive - Determines how many bytes are written to serialize various ranges of integers:
| Bytes | true | false |
| 1 | 0 <= value <= 127 | -64 <= value <= 63 |
| 2 | 128 <= value <= 16383 | -8192 <= value <= 8191 |
| 3 | 16384 <= value <= 2097151 | -1048576 <= value <= 1048575 |
| 4 | 2097152 <= value <= 268435455 | -134217728 <= value <= 134217727 |
| 5 | value < 0 || value > 268435455 | value < -134217728 || value > 134217727 |
| Method Detail |
|---|
public java.lang.Integer readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class type)
Serializer
readObjectData in class Serializer
public void writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object object)
Serializer
writeObjectData in class Serializerobject - Cannot be null.
public static int put(java.nio.ByteBuffer buffer,
int value,
boolean optimizePositive)
optimizePositive - See IntSerializer(boolean).
public static int get(java.nio.ByteBuffer buffer,
boolean optimizePositive)
put(ByteBuffer, int, boolean).
public static boolean canRead(java.nio.ByteBuffer buffer,
boolean optimizePositive)
put(ByteBuffer, int, boolean).
public static int length(int value,
boolean optimizePositive)
put(ByteBuffer, int, boolean).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||