public class PrettySerializer extends Serializer
Modifier and Type | Field and Description |
---|---|
static String |
MEDIA_TYPE |
DEFAULT_STRICT
Constructor and Description |
---|
PrettySerializer() |
PrettySerializer(boolean strict) |
Modifier and Type | Method and Description |
---|---|
boolean |
binaryProtocol() |
PrettySerializer |
compact()
Make a PrettySerializer that generates content similar to the PMessage asString methods.
|
PrettySerializer |
config()
Make a PrettySerializer that generates content similar to what the ProvidenceConfig
reads.
|
PrettySerializer |
debug()
Make a PrettySerializer that generates content with minimal diff.
|
<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 input,
PService service)
Deserialize a service call.
|
String |
mediaType() |
<Message extends PMessage<Message,Field>,Field extends PField> |
serialize(OutputStream out,
Message message)
Serialize a message.
|
<Message extends PMessage<Message,Field>,Field extends PField> |
serialize(OutputStream out,
PServiceCall<Message,Field> call)
Serialize a service call.
|
PrettySerializer |
string()
Make a PrettySerializer that generates content similar to the PMessage toString methods.
|
isRequestCallType
public static final String MEDIA_TYPE
public PrettySerializer()
public PrettySerializer(boolean strict)
public PrettySerializer compact()
string()
variant, but without the qualified name prefix.public PrettySerializer string()
PMessage
.toString() would expect.public PrettySerializer config()
public PrettySerializer debug()
public <Message extends PMessage<Message,Field>,Field extends PField> int serialize(@Nonnull OutputStream out, @Nonnull Message message)
Serializer
serialize
in class Serializer
Message
- The message type.Field
- The message field type.out
- The output stream to write to.message
- The message to write.public <Message extends PMessage<Message,Field>,Field extends PField> int serialize(@Nonnull OutputStream out, @Nonnull PServiceCall<Message,Field> call) throws IOException
Serializer
serialize
in class Serializer
Message
- The message type contained in the service call.Field
- The message field type.out
- 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> PServiceCall<Message,Field> deserialize(@Nonnull InputStream input, @Nonnull PService service) throws IOException
Serializer
deserialize
in class Serializer
Message
- The message type contained in the returned service call.Field
- The message field type.input
- The input stream to read from.service
- The service definition to read for.IOException
- If reading or deserialization failed.@Nonnull public <Message extends PMessage<Message,Field>,Field extends PField> Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message,Field> descriptor) throws IOException
Serializer
deserialize
in class Serializer
Message
- 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.public boolean binaryProtocol()
binaryProtocol
in class Serializer
@Nonnull public String mediaType()
mediaType
in class Serializer
Copyright © 2015–2017 morimekta.net. All rights reserved.