public abstract class Serializer extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_STRICT
Default value for the "strict" serializer settings.
|
Constructor and Description |
---|
Serializer() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
binaryProtocol() |
abstract <Message extends PMessage<Message>> |
deserialize(InputStream input,
PMessageDescriptor<Message> descriptor)
Deserialize a message.
|
abstract <Message extends PMessage<Message>> |
deserialize(InputStream input,
PService service)
Deserialize a service call.
|
protected boolean |
isRequestCallType(PServiceCallType type)
Utility method to check if a service call is a request type.
|
abstract String |
mediaType() |
abstract <Message extends PMessage<Message>> |
serialize(OutputStream output,
PMessageOrBuilder<Message> message)
Serialize a message.
|
abstract <Message extends PMessage<Message>> |
serialize(OutputStream output,
PServiceCall<Message> call)
Serialize a service call.
|
String |
toString() |
abstract void |
verifyEndOfContent(InputStream input)
Verify that the input stream does not contain any more readable content and
close the stream.
|
public static final boolean DEFAULT_STRICT
public abstract <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream output, @Nonnull PMessageOrBuilder<Message> message) throws IOException
Message
- The message type.output
- The output stream to write to.message
- The message to write.IOException
- If writing or serialization failed.public abstract <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream output, @Nonnull PServiceCall<Message> call) throws IOException
Message
- The message type contained in the service call.output
- The output stream to write to.call
- The service call to write.IOException
- If writing or serialization failed.@Nonnull public abstract <Message extends PMessage<Message>> Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message> descriptor) throws IOException
Message
- The message type.input
- The input stream to read from.descriptor
- The descriptor of the message to read.IOException
- If reading or deserialization failed.@Nonnull public abstract <Message extends PMessage<Message>> PServiceCall<Message> deserialize(@Nonnull InputStream input, @Nonnull PService service) throws IOException
Message
- The message type contained in the returned service call.input
- The input stream to read from.service
- The service definition to read for.IOException
- If reading or deserialization failed.public abstract boolean binaryProtocol()
public abstract void verifyEndOfContent(@Nonnull InputStream input) throws IOException
input
- The input stream to check.IOException
- If unable to read from stream or stream contains meaningful content.@Nonnull public abstract String mediaType()
protected boolean isRequestCallType(PServiceCallType type)
type
- The service call type.Copyright © 2015–2020 morimekta.net. All rights reserved.