PrettySerializer extends Serializer { public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream out, @Nonnull Message message) { CountingOutputStream cout = new CountingOutputStream(out); IndentedPrintWriter builder = new IndentedPrintWriter(cout, indent, newline); if (prefixWithQualifiedName) { builder.append(message.descriptor().getQualifiedName()) .append(space); } appendMessage(builder, message, false); builder.flush(); return cout.getByteCount(); } PrettySerializer();  PrettySerializer(boolean strict); private  PrettySerializer(String indent,
                             String space,
                             String newline,
                             String entrySep,
                             boolean strict,
                             boolean prefixWithQualifiedName); PrettySerializer compact(); PrettySerializer string(); PrettySerializer config(); int serialize(@Nonnull OutputStream out, @Nonnull Message message); @Override int serialize(@Nonnull OutputStream out, @Nonnull PServiceCall<Message, Field> call); @Nonnull @Override @SuppressWarnings("unchecked") PServiceCall<Message, Field> deserialize(@Nonnull InputStream input, @Nonnull PService service); @Nonnull @Override Message deserialize(@Nonnull InputStream input,
                        @Nonnull PMessageDescriptor<Message, Field> descriptor); @Override boolean binaryProtocol(); @Nonnull @Override String mediaType(); final static String MEDIA_TYPE; }
@Test public void testFormat() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrettySerializer serializer = new PrettySerializer(); serializer.serialize(baos, mOperation); assertEquals(mFormatted, new String(baos.toByteArray(), UTF_8)); }