|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.helidb.lang.serializer.StringSerializer
public class StringSerializer
A Serializer for String values. Every String value
serialized by this object is represented as a byte array. The modified UTF-8
format described in the DataInput is used to serialize the
String.
Strings must not be so long that they cannot fit into a byte array of length
65535. See the DataInput interface.
This serializer does not handle null values.
The singleton instance INSTANCE may be used instead of creating a
new object of this class.
StringNullSerializer,
ConstantSizeStringSerializer,
String| Field Summary | |
|---|---|
static StringSerializer |
INSTANCE
The singleton instance. |
| Constructor Summary | |
|---|---|
StringSerializer()
|
|
| Method Summary | |
|---|---|
int |
getSerializedSize()
If the serialized data produced by this serializer always is of the same size, return that size (in number of bytes). |
String |
interpret(byte[] barr)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
String |
interpret(byte[] barr,
int offset,
int length)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
boolean |
isNullValuesPermitted()
Does this serializer permit null values? |
String |
read(InputStream is,
int dataSize)
Read a value from the InputStream. |
String |
read(RandomAccess ra,
int dataSize)
Read a value from the RandomAccess' current position. |
byte[] |
serialize(String s)
Serialize the supplied object into a new byte array. |
int |
serialize(String s,
byte[] barr,
int offset)
Serialize the supplied object into the byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final StringSerializer INSTANCE
| Constructor Detail |
|---|
public StringSerializer()
| Method Detail |
|---|
public String interpret(byte[] barr,
int offset,
int length)
Serializerbyte array to an object of the type
handled by the Serializer implementation.
interpret in interface Serializer<String>barr - The byte array containing the data.offset - The start position of the data.length - The length of the data.
Serializer.interpret(byte[])public String interpret(byte[] barr)
Serializerbyte array to an object of the type
handled by the Serializer implementation.
interpret in interface Serializer<String>barr - The byte array containing the data.
Serializer.interpret(byte[], int, int)
public int serialize(String s,
byte[] barr,
int offset)
Serializerbyte array.
serialize in interface Serializer<String>s - The object to serialize.barr - The byte array to serialize it to.offset - The start position to write data at in the byte array.
public byte[] serialize(String s)
Serializerbyte array.
serialize in interface Serializer<String>s - The object to serialize.
byte array.public int getSerializedSize()
Serializer-1 is
returned.
getSerializedSize in interface Serializer<String>-1, always.public boolean isNullValuesPermitted()
Serializernull values?
isNullValuesPermitted in interface Serializer<String>false, always.
public String read(RandomAccess ra,
int dataSize)
SerializerRandomAccess' current position. The
position in the RandomAccess is incremented by size
bytes.
read in interface Serializer<String>ra - The RandomAccess to read from.dataSize - The size of the value.
public String read(InputStream is,
int dataSize)
SerializerInputStream.
read in interface Serializer<String>is - The InputStream to read from.dataSize - The size of the value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||