de.lmu.ifi.dbs.elki.persistent
Class ByteArrayUtil.VarintSerializer

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.persistent.ByteArrayUtil.VarintSerializer
All Implemented Interfaces:
ByteBufferSerializer<Integer>
Enclosing class:
ByteArrayUtil

public static class ByteArrayUtil.VarintSerializer
extends Object
implements ByteBufferSerializer<Integer>

Serializer for Integer objects using a variable size encoding


Constructor Summary
protected ByteArrayUtil.VarintSerializer()
          Constructor.
 
Method Summary
 Integer fromByteBuffer(ByteBuffer buffer)
          Deserialize an object from a byte buffer (e.g. disk)
 int getByteSize(Integer object)
          Get the size of the object in bytes.
 void toByteBuffer(ByteBuffer buffer, Integer obj)
          Serialize the object to a byte array (e.g. disk)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayUtil.VarintSerializer

protected ByteArrayUtil.VarintSerializer()
Constructor. Protected: use static instance!

Method Detail

fromByteBuffer

public Integer fromByteBuffer(ByteBuffer buffer)
Description copied from interface: ByteBufferSerializer
Deserialize an object from a byte buffer (e.g. disk)

Specified by:
fromByteBuffer in interface ByteBufferSerializer<Integer>
Parameters:
buffer - Data array to process
Returns:
Deserialized object

toByteBuffer

public void toByteBuffer(ByteBuffer buffer,
                         Integer obj)
Description copied from interface: ByteBufferSerializer
Serialize the object to a byte array (e.g. disk)

Specified by:
toByteBuffer in interface ByteBufferSerializer<Integer>
Parameters:
buffer - Buffer to serialize to
obj - Object to serialize

getByteSize

public int getByteSize(Integer object)
Description copied from interface: ByteBufferSerializer
Get the size of the object in bytes.

Specified by:
getByteSize in interface ByteBufferSerializer<Integer>
Parameters:
object - Object to serialize
Returns:
maximum size in serialized form

Release 0.4.0 (2011-09-20_1324)