public class StringSerializer extends AbstractElementSerializer<String>
Modifier and Type | Field and Description |
---|---|
static StringSerializer |
INSTANCE
A static instance of a StringSerializer
|
Constructor and Description |
---|
StringSerializer(Comparator<String> comparator)
Create a new instance of StringSerializer with custom comparator
|
Modifier and Type | Method and Description |
---|---|
int |
compare(String type1,
String type2)
Returns the comparison of two types.
|
String |
deserialize(BufferHandler bufferHandler)
Deserialize an element from a BufferHandler
|
static String |
deserialize(byte[] in)
A static method used to deserialize a String from a byte array.
|
static String |
deserialize(byte[] in,
int start)
A static method used to deserialize a String from a byte array.
|
String |
deserialize(ByteBuffer buffer)
Deserialize an element from a ByteBuffer
|
String |
fromBytes(byte[] in)
A method used to deserialize a String from a byte array.
|
String |
fromBytes(byte[] in,
int start)
A method used to deserialize a String from a byte array.
|
static byte[] |
serialize(byte[] buffer,
int start,
String element)
Serialize a String.
|
byte[] |
serialize(String element)
Produce the byte[] representation of the element
|
getComparator, getType
public static final StringSerializer INSTANCE
public StringSerializer(Comparator<String> comparator)
public static String deserialize(byte[] in)
in
- The byte array containing the Stringpublic static String deserialize(byte[] in, int start)
in
- The byte array containing the Stringpublic String fromBytes(byte[] in)
in
- The byte array containing the Stringpublic String fromBytes(byte[] in, int start)
in
- The byte array containing the Stringpublic static byte[] serialize(byte[] buffer, int start, String element)
buffer
- the Buffer that will contain the serialized valuestart
- the position in the buffer we will store the serialized Stringvalue
- the value to serializepublic byte[] serialize(String element)
element
- The element to serializepublic String deserialize(BufferHandler bufferHandler) throws IOException
bufferHandler
- The incoming bufferHandlerIOException
public String deserialize(ByteBuffer buffer) throws IOException
buffer
- The incoming ByteBufferIOException
- If the deserialization failedpublic int compare(String type1, String type2)
compare
in interface ElementSerializer<String>
compare
in class AbstractElementSerializer<String>
type1
- The first type to comparetype2
- The second type to compareCopyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.