public class PProtoSerializer extends PSerializer
docs/proto-serializer.md for format
spec and type matching.DEFAULT_ENTRY_SEP, DEFAULT_STREAM_INITIATOR, DEFAULT_STREAM_TERMINATOR| Constructor and Description |
|---|
PProtoSerializer()
Construct a serializer instance.
|
PProtoSerializer(boolean strict)
Construct a serializer instance.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
deserialize(InputStream input,
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 output,
PDescriptor<T> descriptor,
T value) |
int |
serialize(OutputStream output,
PMessage<?> message) |
protected int |
writeFieldValue(net.morimekta.util.io.BinaryWriter out,
int tag,
PDescriptor<?> descriptor,
Object value)
Write a field value to stream.
|
protected int |
writeMessage(net.morimekta.util.io.BinaryWriter writer,
PMessage<?> message) |
cast, entrySeparator, streamInitiator, streamInitiatorPartOfData, streamTerminatorpublic PProtoSerializer()
public PProtoSerializer(boolean strict)
public int serialize(OutputStream output, PMessage<?> message) throws IOException, PSerializeException
serialize in class PSerializerIOExceptionPSerializeExceptionpublic <T> int serialize(OutputStream output, PDescriptor<T> descriptor, T value) throws IOException, PSerializeException
serialize in class PSerializerIOExceptionPSerializeExceptionpublic <T> T deserialize(InputStream input, PDescriptor<T> descriptor) throws PSerializeException, IOException
deserialize in class PSerializerPSerializeExceptionIOExceptionprotected int writeMessage(net.morimekta.util.io.BinaryWriter writer,
PMessage<?> message)
throws IOException,
PSerializeException
IOExceptionPSerializeExceptionprotected <T> T readFieldValue(net.morimekta.util.io.BinaryReader in,
int type,
PDescriptor<T> descriptor)
throws IOException,
PSerializeException
in - The stream to consume.type - The field info about the content.descriptor - The type to generate content for.IOException - If unable to read from stream or invalid field type.PSerializeExceptionprotected int writeFieldValue(net.morimekta.util.io.BinaryWriter out,
int tag,
PDescriptor<?> descriptor,
Object value)
throws IOException,
PSerializeException
out - The stream to write to.value - The value to write.IOExceptionPSerializeExceptionCopyright © 2016. All rights reserved.