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

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

public static class ByteArrayUtil.StringSerializer
extends Object
implements ByteBufferSerializer<String>

Serializer for String objects


Field Summary
(package private)  Charset charset
          Character set to use
(package private)  CharsetDecoder decoder
          Decoder
(package private)  CharsetEncoder encoder
          Encoder
 
Constructor Summary
protected ByteArrayUtil.StringSerializer()
          Constructor.
 
Method Summary
 String fromByteBuffer(ByteBuffer buffer)
          Deserialize an object from a byte buffer (e.g. disk)
 int getByteSize(String object)
          Get the size of the object in bytes.
 void toByteBuffer(ByteBuffer buffer, String 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
 

Field Detail

charset

Charset charset
Character set to use


encoder

CharsetEncoder encoder
Encoder


decoder

CharsetDecoder decoder
Decoder

Constructor Detail

ByteArrayUtil.StringSerializer

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

Method Detail

fromByteBuffer

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

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

toByteBuffer

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

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

getByteSize

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

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

Release 0.4.0 (2011-09-20_1324)