public class PFastBinarySerializer extends PSerializer
docs/fast-binary.md for format spec.| Modifier and Type | Field and Description |
|---|---|
protected static int |
BINARY |
protected static int |
COLLECTION |
protected static int |
FIXED_64 |
protected static int |
MESSAGE |
protected static int |
NONE |
protected boolean |
readStrict |
protected static int |
TRUE |
protected static int |
VARINT |
DEFAULT_ENTRY_SEP, DEFAULT_STREAM_INITIATOR, DEFAULT_STREAM_TERMINATOR| Constructor and Description |
|---|
PFastBinarySerializer()
Construct a serializer instance.
|
PFastBinarySerializer(boolean readStrict)
Construct a serializer instance.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
deserialize(InputStream is,
PDescriptor<T> descriptor) |
protected <T> T |
readFieldValue(net.morimekta.util.io.BinaryReader in,
int type,
PDescriptor<T> descriptor)
Read a field value from stream.
|
<T> int |
serialize(OutputStream os,
PDescriptor<T> descriptor,
T value) |
int |
serialize(OutputStream os,
PMessage<?> message) |
protected int |
writeMessage(net.morimekta.util.io.BinaryWriter out,
PMessage<?> message) |
cast, entrySeparator, streamInitiator, streamInitiatorPartOfData, streamTerminatorprotected final boolean readStrict
protected static final int NONE
protected static final int TRUE
protected static final int VARINT
protected static final int FIXED_64
protected static final int BINARY
protected static final int MESSAGE
protected static final int COLLECTION
public PFastBinarySerializer()
public PFastBinarySerializer(boolean readStrict)
public int serialize(OutputStream os, PMessage<?> message) throws IOException, PSerializeException
serialize in class PSerializerIOExceptionPSerializeExceptionpublic <T> int serialize(OutputStream os, PDescriptor<T> descriptor, T value) throws IOException, PSerializeException
serialize in class PSerializerIOExceptionPSerializeExceptionpublic <T> T deserialize(InputStream is, PDescriptor<T> descriptor) throws PSerializeException, IOException
deserialize in class PSerializerPSerializeExceptionIOExceptionprotected int writeMessage(net.morimekta.util.io.BinaryWriter out,
PMessage<?> message)
throws IOException,
PSerializeException
out - Writer to write to.message - Message to write.PSerializeException - When serialization failed.IOException - When unable to write to stream as expected.protected <T> T readFieldValue(net.morimekta.util.io.BinaryReader in,
int type,
PDescriptor<T> descriptor)
throws IOException,
PSerializeException
in - The stream to consume.type - The encoded type.descriptor - The type descriptor to generate content for.IOException - If unable to read from stream or invalid field type.PSerializeExceptionCopyright © 2016. All rights reserved.