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.
|
<Message extends PMessage<Message>> |
deserialize(InputStream input,
PMessageDescriptor<Message> descriptor)
Deserialize a message.
|
<Message extends PMessage<Message>> |
deserialize(InputStream input,
PService service)
Deserialize a service call.
|
String |
mediaType() |
static <Message extends PMessage<Message>> |
parseDebugString(String string,
PMessageDescriptor<Message> descriptor)
Parses a pretty formatted string, and makes exceptions unchecked.
|
<Message extends PMessage<Message>> |
serialize(OutputStream out,
PMessageOrBuilder<Message> message)
Serialize a message.
|
<Message extends PMessage<Message>> |
serialize(OutputStream out,
PServiceCall<Message> call)
Serialize a service call.
|
PrettySerializer |
string()
Make a PrettySerializer that generates content similar to the PMessage toString methods.
|
static <Message extends PMessage<Message>> |
toDebugString(PMessageOrBuilder<Message> message)
Prints a pretty formatted string that is optimized for diffing (mainly
for testing and debugging).
|
void |
verifyEndOfContent(InputStream input)
Verify that the input stream does not contain any more readable content and
close the stream.
|
isRequestCallType, toStringpublic static final String MEDIA_TYPE
public PrettySerializer()
public PrettySerializer(boolean strict)
@Nonnull public static <Message extends PMessage<Message>> String toDebugString(PMessageOrBuilder<Message> message)
Message - The message type.message - The message to stringify.@Nonnull public static <Message extends PMessage<Message>> Message parseDebugString(String string, PMessageDescriptor<Message> descriptor)
Message - The message type.string - The message string to parse.descriptor - The message descriptor.public PrettySerializer compact()
string() variant, but without the qualified name prefix.public PrettySerializer string()
PMessage.toString() would expect.public PrettySerializer config()
public <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream out, @Nonnull PMessageOrBuilder<Message> message)
Serializerserialize in class SerializerMessage - The message type.out - The output stream to write to.message - The message to write.public <Message extends PMessage<Message>> int serialize(@Nonnull OutputStream out, @Nonnull PServiceCall<Message> call)
Serializerserialize in class SerializerMessage - The message type contained in the service call.out - The output stream to write to.call - The service call to write.@Nonnull public <Message extends PMessage<Message>> PServiceCall<Message> deserialize(@Nonnull InputStream input, @Nonnull PService service) throws IOException
Serializerdeserialize in class SerializerMessage - 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.@Nonnull public <Message extends PMessage<Message>> Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message> descriptor) throws IOException
Serializerdeserialize in class SerializerMessage - The message 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 Serializerpublic void verifyEndOfContent(@Nonnull InputStream input) throws IOException
SerializerverifyEndOfContent in class Serializerinput - The input stream to check.IOException - If unable to read from stream or stream contains meaningful content.@Nonnull public String mediaType()
mediaType in class SerializerCopyright © 2015–2020 morimekta.net. All rights reserved.