Package elki.utilities.io
Class ByteArrayUtil.StringSerializer
- java.lang.Object
-
- elki.utilities.io.ByteArrayUtil.StringSerializer
-
- All Implemented Interfaces:
ByteBufferSerializer<java.lang.String>
- Enclosing class:
- ByteArrayUtil
public static final class ByteArrayUtil.StringSerializer extends java.lang.Object implements ByteBufferSerializer<java.lang.String>
Serializer for String objects.- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Modifier Constructor Description private
StringSerializer()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
fromByteBuffer(java.nio.ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g., disk)int
getByteSize(java.lang.String object)
Get the size of the object in bytes.void
toByteBuffer(java.nio.ByteBuffer buffer, java.lang.String obj)
Serialize the object to a byte array (e.g., disk)
-
-
-
Method Detail
-
fromByteBuffer
public java.lang.String fromByteBuffer(java.nio.ByteBuffer buffer) throws java.io.IOException
Description copied from interface:ByteBufferSerializer
Deserialize an object from a byte buffer (e.g., disk)- Specified by:
fromByteBuffer
in interfaceByteBufferSerializer<java.lang.String>
- Parameters:
buffer
- Data array to process- Returns:
- Deserialized object
- Throws:
java.io.IOException
- on IO errors
-
toByteBuffer
public void toByteBuffer(java.nio.ByteBuffer buffer, java.lang.String obj) throws java.io.IOException
Description copied from interface:ByteBufferSerializer
Serialize the object to a byte array (e.g., disk)- Specified by:
toByteBuffer
in interfaceByteBufferSerializer<java.lang.String>
- Parameters:
buffer
- Buffer to serialize toobj
- Object to serialize- Throws:
java.io.IOException
- on IO errors
-
getByteSize
public int getByteSize(java.lang.String object) throws java.io.IOException
Description copied from interface:ByteBufferSerializer
Get the size of the object in bytes.- Specified by:
getByteSize
in interfaceByteBufferSerializer<java.lang.String>
- Parameters:
object
- Object to serialize- Returns:
- maximum size in serialized form
- Throws:
java.io.IOException
- on IO errors
-
-