|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.lang.serializer.StringSerializer
org.helidb.lang.serializer.StringNullSerializer
public class StringNullSerializer
This is a String
serializer that can handle null
values.
null
values are encoded to a special string. Other String
:s
that happen to start with the special String
are escaped. This should
be transparent to the client.
The singleton instance INSTANCE
uses "[null]" to
represent null
values. It may be used instead of instantiating this
class.
For more documentation on String
serialization, see
StringSerializer
.
StringSerializer
,
ConstantSizeStringNullSerializer
,
String
Field Summary | |
---|---|
static String |
DEFAULT_NULL_VALUE
The default special null value. |
static StringNullSerializer |
INSTANCE
This instance uses the default special null value. |
Constructor Summary | |
---|---|
StringNullSerializer(String nullValue)
Instantiate the serializer. |
Method Summary | |
---|---|
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? |
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 org.helidb.lang.serializer.StringSerializer |
---|
getSerializedSize, read, read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_NULL_VALUE
null
value.
public static final StringNullSerializer INSTANCE
null
value. It should be
useful in most circumstances.
Constructor Detail |
---|
public StringNullSerializer(String nullValue)
nullValue
- The special String
used to represent null
values.Method Detail |
---|
public boolean isNullValuesPermitted()
Serializer
null
values?
isNullValuesPermitted
in interface Serializer<String>
isNullValuesPermitted
in class StringSerializer
true
, always.public int serialize(String s, byte[] barr, int offset)
Serializer
byte
array.
serialize
in interface Serializer<String>
serialize
in class StringSerializer
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)
Serializer
byte
array.
serialize
in interface Serializer<String>
serialize
in class StringSerializer
s
- The object to serialize.
byte
array.public String interpret(byte[] barr, int offset, int length)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<String>
interpret
in class StringSerializer
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)
Serializer
byte
array to an object of the type
handled by the Serializer
implementation.
interpret
in interface Serializer<String>
interpret
in class StringSerializer
barr
- The byte
array containing the data.
Serializer.interpret(byte[], int, int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |