public class BinarySerializer extends Serializer
See data definition file docs/serializer-binary.md for format
spec.
| Modifier and Type | Field and Description |
|---|---|
static String |
ALT_MEDIA_TYPE |
static String |
MEDIA_TYPE |
DEFAULT_STRICT| Constructor and Description |
|---|
BinarySerializer()
Construct a serializer instance.
|
BinarySerializer(boolean readStrict)
Construct a serializer instance.
|
BinarySerializer(boolean readStrict,
boolean versioned)
Construct a serializer instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
binaryProtocol() |
<Message extends PMessage<Message,Field>,Field extends PField> |
deserialize(InputStream input,
PMessageDescriptor<Message,Field> descriptor)
Deserialize a message.
|
<Message extends PMessage<Message,Field>,Field extends PField> |
deserialize(InputStream is,
PService service)
Deserialize a service call.
|
String |
mediaType() |
<Message extends PMessage<Message,Field>,Field extends PField> |
serialize(OutputStream os,
Message message)
Serialize a message.
|
<Message extends PMessage<Message,Field>,Field extends PField> |
serialize(OutputStream os,
PServiceCall<Message,Field> call)
Serialize a service call.
|
isRequestCallTypepublic static final String MEDIA_TYPE
public static final String ALT_MEDIA_TYPE
public BinarySerializer()
public BinarySerializer(boolean readStrict)
readStrict - If the serializer should fail on bad reading.public BinarySerializer(boolean readStrict,
boolean versioned)
readStrict - If the serializer should fail on reading mismatched data.versioned - If the serializer should use the versioned service call format.public boolean binaryProtocol()
binaryProtocol in class Serializer@Nonnull public String mediaType()
mediaType in class Serializerpublic <Message extends PMessage<Message,Field>,Field extends PField> int serialize(@Nonnull OutputStream os, @Nonnull Message message) throws IOException
Serializerserialize in class SerializerMessage - The message type.Field - The message field type.os - The output stream to write to.message - The message to write.IOException - If writing or serialization failed.public <Message extends PMessage<Message,Field>,Field extends PField> int serialize(@Nonnull OutputStream os, @Nonnull PServiceCall<Message,Field> call) throws IOException
Serializerserialize in class SerializerMessage - The message type contained in the service call.Field - The message field type.os - The output stream to write to.call - The service call to write.IOException - If writing or serialization failed.@Nonnull public <Message extends PMessage<Message,Field>,Field extends PField> Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message,Field> descriptor) throws IOException
Serializerdeserialize in class SerializerMessage - The message type.Field - The message field type.input - The input stream to read from.descriptor - The descriptor of the message to read.IOException - If reading or deserialization failed.@Nonnull public <Message extends PMessage<Message,Field>,Field extends PField> PServiceCall<Message,Field> deserialize(@Nonnull InputStream is, @Nonnull PService service) throws IOException
Serializerdeserialize in class SerializerMessage - The message type contained in the returned service call.Field - The message field type.is - The input stream to read from.service - The service definition to read for.IOException - If reading or deserialization failed.Copyright © 2015–2017 morimekta.net. All rights reserved.