public class FastBinarySerializer extends Serializer
Documentation: Fast Binary Serialization Format with IDL and explanation.
Modifier and Type | Field and Description |
---|---|
static String |
MEDIA_TYPE |
DEFAULT_STRICT
Constructor and Description |
---|
FastBinarySerializer()
Construct a serializer instance.
|
FastBinarySerializer(boolean readStrict)
Construct a serializer instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
binaryProtocol() |
<Message extends PMessage<Message>> |
deserialize(InputStream is,
PMessageDescriptor<Message> descriptor)
Deserialize a message.
|
<Message extends PMessage<Message>> |
deserialize(InputStream is,
PService service)
Deserialize a service call.
|
String |
mediaType() |
<Message extends PMessage<Message>> |
serialize(OutputStream os,
PMessageOrBuilder<Message> message)
Serialize a message.
|
<Message extends PMessage<Message>> |
serialize(OutputStream os,
PServiceCall<Message> call)
Serialize a service call.
|
void |
verifyEndOfContent(InputStream input)
Verify that the input stream does not contain any more readable content and
close the stream.
|
isRequestCallType, toString
public static final String MEDIA_TYPE
public FastBinarySerializer()
public FastBinarySerializer(boolean readStrict)
readStrict
- If serializer should fail on unknown input data.public <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream os, @Nonnull PMessageOrBuilder<Message> message) throws IOException
Serializer
serialize
in class Serializer
Message
- The message type.os
- The output stream to write to.message
- The message to write.IOException
- If writing or serialization failed.public <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream os, @Nonnull PServiceCall<Message> call) throws IOException
Serializer
serialize
in class Serializer
Message
- The message type contained in the service call.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>> Message deserialize(@Nonnull InputStream is, @Nonnull PMessageDescriptor<Message> descriptor) throws IOException
Serializer
deserialize
in class Serializer
Message
- The message type.is
- 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>> PServiceCall<Message> deserialize(@Nonnull InputStream is, @Nonnull PService service) throws SerializerException
Serializer
deserialize
in class Serializer
Message
- The message type contained in the returned service call.is
- The input stream to read from.service
- The service definition to read for.SerializerException
public boolean binaryProtocol()
binaryProtocol
in class Serializer
public void verifyEndOfContent(@Nonnull InputStream input) throws IOException
Serializer
verifyEndOfContent
in class Serializer
input
- The input stream to check.IOException
- If unable to read from stream or stream contains meaningful content.@Nonnull public String mediaType()
mediaType
in class Serializer
Copyright © 2015–2020 morimekta.net. All rights reserved.