java.lang.Object
net.metanotion.io.data.StringBytes
- All Implemented Interfaces:
Serializer<String>
String serializer using US-ASCII encoding.
Converts between String objects and US-ASCII byte arrays. Only supports 7-bit ASCII characters.
Note: Use only when data is guaranteed to contain only US-ASCII. For Unicode text, use UTF8StringBytes instead.
If string contains characters outside US-ASCII range, an Error is thrown.
Constructor Summary
ConstructorsConstructorDescriptionThe codec holds no state - the US-ASCII charset is named on every call - so a bare instance is ready to serialise.Method Summary
All Methods
Constructor Details
StringBytes
public StringBytes()The codec holds no state - the US-ASCII charset is named on every call - so a bare instance is ready to serialise.
Method Details
getBytes
Description copied from interface:Serializero).- Specified by:
getBytesin interfaceSerializer<String>- Parameters:
o- the object to serialize- Returns:
- the given object's serialized form as a byte array
construct
Description copied from interface:Serializerb).- Specified by:
constructin interfaceSerializer<String>- Parameters:
b- the serialized bytes to read back- Returns:
- the deserialized object