public class BinaryFormatConverter extends Converter<byte[]>
byte[].| Modifier and Type | Class and Description |
|---|---|
protected static class |
BinaryFormatConverter.ByteString
A string of bytes used to implement serialization for
BinaryFormatConverter. |
protected class |
BinaryFormatConverter.Input
Input used during deserialization.
|
| Modifier and Type | Field and Description |
|---|---|
protected static byte |
TYPE_BYTES |
protected static byte |
TYPE_INT |
protected static byte |
TYPE_INT_INLINE |
protected static byte |
TYPE_LIST |
protected static byte |
TYPE_MAP |
protected static byte |
TYPE_NULL |
protected static byte |
TYPE_OBJ |
protected static byte |
TYPE_REPR |
protected static byte |
TYPE_STR |
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
well_known_string_indices
Maps a well-known string to its index in
this.well_known_strings. |
protected java.util.ArrayList<java.lang.String> |
well_known_strings
Stores well-known strings (see
BinaryFormatConverter(List, List)). |
| Constructor and Description |
|---|
BinaryFormatConverter() |
BinaryFormatConverter(java.util.List<java.lang.String> well_known_strings,
java.util.List<java.lang.Class<?>> well_known_classes)
Instantiates the converter with lists of strings and classes well-known by both serializer and deserializer.
|
| Modifier and Type | Method and Description |
|---|---|
Representation |
deserialize(byte[] data)
Deserializes the given object to its representation.
|
byte[] |
serialize(Representation r)
Serializes the given representation to the type supported by this converter.
|
protected static final byte TYPE_OBJ
protected static final byte TYPE_INT
protected static final byte TYPE_INT_INLINE
protected static final byte TYPE_STR
protected static final byte TYPE_BYTES
protected static final byte TYPE_REPR
protected static final byte TYPE_LIST
protected static final byte TYPE_MAP
protected static final byte TYPE_NULL
protected final java.util.HashMap<java.lang.String,java.lang.Integer> well_known_string_indices
this.well_known_strings.
Fulfills contract that str.equals(well_known_strings.get(well_known_string_indices.get(str))).
protected final java.util.ArrayList<java.lang.String> well_known_strings
BinaryFormatConverter(List, List)).
Fulfills contract that str.equals(well_known_strings.get(well_known_string_indices.get(str))).
public BinaryFormatConverter()
public BinaryFormatConverter(java.util.List<java.lang.String> well_known_strings,
java.util.List<java.lang.Class<?>> well_known_classes)
These strings and class names won't appear in the serialization result (making it shorter by omitting strings from the byte array result of serialization). For serialization and deserialization, the lists passed here must be equal (in particular, the order of elements is important).
public byte[] serialize(Representation r)
Converterpublic Representation deserialize(byte[] data)
Converterdeserialize in class Converter<byte[]>data - the object to deserialize