public class StringSerializer extends AbstractElementSerializer<java.lang.String>
| Modifier and Type | Field and Description |
|---|---|
static StringSerializer |
INSTANCE
A static instance of a StringSerializer
|
| Modifier | Constructor and Description |
|---|---|
private |
StringSerializer()
Create a new instance of StringSerializer
|
|
StringSerializer(java.util.Comparator<java.lang.String> comparator)
Create a new instance of StringSerializer with custom comparator
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(java.lang.String type1,
java.lang.String type2)
Returns the comparison of two types.
|
java.lang.String |
deserialize(BufferHandler bufferHandler)
Deserialize an element from a BufferHandler
|
static java.lang.String |
deserialize(byte[] in)
A static method used to deserialize a String from a byte array.
|
static java.lang.String |
deserialize(byte[] in,
int start)
A static method used to deserialize a String from a byte array.
|
java.lang.String |
deserialize(java.nio.ByteBuffer buffer)
Deserialize an element from a ByteBuffer
|
java.lang.String |
fromBytes(byte[] in)
A method used to deserialize a String from a byte array.
|
java.lang.String |
fromBytes(byte[] in,
int start)
A method used to deserialize a String from a byte array.
|
static byte[] |
serialize(byte[] buffer,
int start,
java.lang.String element)
Serialize a String.
|
byte[] |
serialize(java.lang.String element)
Produce the byte[] representation of the element
|
getComparator, getTypepublic static final StringSerializer INSTANCE
private StringSerializer()
public StringSerializer(java.util.Comparator<java.lang.String> comparator)
public static java.lang.String deserialize(byte[] in)
in - The byte array containing the Stringpublic static java.lang.String deserialize(byte[] in,
int start)
in - The byte array containing the Stringpublic java.lang.String fromBytes(byte[] in)
in - The byte array containing the Stringpublic java.lang.String fromBytes(byte[] in,
int start)
in - The byte array containing the Stringpublic static byte[] serialize(byte[] buffer,
int start,
java.lang.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(java.lang.String element)
element - The element to serializepublic java.lang.String deserialize(BufferHandler bufferHandler) throws java.io.IOException
bufferHandler - The incoming bufferHandlerjava.io.IOExceptionpublic java.lang.String deserialize(java.nio.ByteBuffer buffer)
throws java.io.IOException
buffer - The incoming ByteBufferjava.io.IOException - If the deserialization failedpublic int compare(java.lang.String type1,
java.lang.String type2)
compare in interface ElementSerializer<java.lang.String>compare in class AbstractElementSerializer<java.lang.String>type1 - The first type to comparetype2 - The second type to compare