com.esotericsoftware.kryo.serialize
Class LongSerializer

java.lang.Object
  extended by com.esotericsoftware.kryo.Serializer
      extended by com.esotericsoftware.kryo.serialize.LongSerializer

public class LongSerializer
extends Serializer

Writes a 1-10 byte long.

Author:
Nathan Sweet

Constructor Summary
LongSerializer()
           
LongSerializer(boolean optimizePositive)
           
 
Method Summary
static long get(java.nio.ByteBuffer buffer, boolean optimizePositive)
          Reads a long from the buffer that was written with put(ByteBuffer, long, boolean).
static long put(java.nio.ByteBuffer buffer, long value, boolean optimizePositive)
          Writes the specified long to the buffer using 1 to 10 bytes, depending on the size of the number.
 java.lang.Long 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

LongSerializer

public LongSerializer()

LongSerializer

public LongSerializer(boolean optimizePositive)
Method Detail

readObjectData

public java.lang.Long readObjectData(java.nio.ByteBuffer buffer,
                                     java.lang.Class type)
Description copied from class: Serializer
Reads an object from the buffer.

Specified by:
readObjectData in class Serializer
Returns:
The deserialized object, never null.

writeObjectData

public void writeObjectData(java.nio.ByteBuffer buffer,
                            java.lang.Object object)
Description copied from class: Serializer
Writes the object to the buffer.

Specified by:
writeObjectData in class Serializer
object - Cannot be null.

put

public static long put(java.nio.ByteBuffer buffer,
                       long value,
                       boolean optimizePositive)
Writes the specified long to the buffer using 1 to 10 bytes, depending on the size of the number.

Parameters:
optimizePositive - See LongSerializer(boolean).
Returns:
the number of bytes written.

get

public static long get(java.nio.ByteBuffer buffer,
                       boolean optimizePositive)
Reads a long from the buffer that was written with put(ByteBuffer, long, boolean).



Copyright © 2011. All Rights Reserved.