public class BinaryFormatUtils extends Object
BinarySerializer
serializer
class instead. It is separated out and made public in order for
pre-generated serialization code to be able to use the same utility
methods.Modifier and Type | Class and Description |
---|---|
static class |
BinaryFormatUtils.FieldInfo
Field info data holder with convenience methods.
|
Constructor and Description |
---|
BinaryFormatUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
consumeMessage(net.morimekta.util.io.BigEndianBinaryReader in)
Consume a message from the stream without parsing the content into a message.
|
static Object |
readFieldValue(net.morimekta.util.io.BigEndianBinaryReader in,
BinaryFormatUtils.FieldInfo fieldInfo,
PDescriptor fieldType,
boolean strict)
Read a field value from stream.
|
static <Message extends PMessage<Message,Field>,Field extends PField> |
readMessage(net.morimekta.util.io.BigEndianBinaryReader input,
PMessageDescriptor<Message,Field> descriptor,
boolean strict)
Read message from reader.
|
static <Message extends PMessage<Message,Field>,Field extends PField> |
writeMessage(net.morimekta.util.io.BigEndianBinaryWriter writer,
Message message)
Write message to writer.
|
public static <Message extends PMessage<Message,Field>,Field extends PField> Message readMessage(net.morimekta.util.io.BigEndianBinaryReader input, PMessageDescriptor<Message,Field> descriptor, boolean strict) throws IOException
Message
- The message type.Field
- The field type.input
- The input reader.descriptor
- The message descriptor.strict
- If the message should be read in strict mode.IOException
- If read failed.public static void consumeMessage(net.morimekta.util.io.BigEndianBinaryReader in) throws IOException
in
- Stream to read message from.IOException
- On read failures.public static Object readFieldValue(net.morimekta.util.io.BigEndianBinaryReader in, BinaryFormatUtils.FieldInfo fieldInfo, PDescriptor fieldType, boolean strict) throws IOException
in
- The stream to consume.fieldInfo
- The field info about the content.fieldType
- The type to generate content for.strict
- If the field should be read strictly.IOException
- If unable to read from stream or invalid field type.public static <Message extends PMessage<Message,Field>,Field extends PField> int writeMessage(net.morimekta.util.io.BigEndianBinaryWriter writer, Message message) throws IOException
Message
- The message type.Field
- The field type.writer
- The binary writer.message
- The message to write.IOException
- If write failed.Copyright © 2015–2018 morimekta.net. All rights reserved.