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 privateStringSerializer()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringfromByteBuffer(java.nio.ByteBuffer buffer)Deserialize an object from a byte buffer (e.g., disk)intgetByteSize(java.lang.String object)Get the size of the object in bytes.voidtoByteBuffer(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.IOExceptionDescription copied from interface:ByteBufferSerializerDeserialize an object from a byte buffer (e.g., disk)- Specified by:
fromByteBufferin 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.IOExceptionDescription copied from interface:ByteBufferSerializerSerialize the object to a byte array (e.g., disk)- Specified by:
toByteBufferin 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.IOExceptionDescription copied from interface:ByteBufferSerializerGet the size of the object in bytes.- Specified by:
getByteSizein interfaceByteBufferSerializer<java.lang.String>- Parameters:
object- Object to serialize- Returns:
- maximum size in serialized form
- Throws:
java.io.IOException- on IO errors
-
-