@Test public void testTSimpleJsonProtocol() throws IOException, TException { ObjectMapper mapper = new ObjectMapper(); ProvidenceModule.register(mapper); ByteArrayOutputStream baos = new ByteArrayOutputStream(); new TSimpleJsonProtocolSerializer().serialize(baos, containers.get(0)); JsonNode node = mapper.readTree(new ByteArrayInputStream(baos.toByteArray())); assertEquals("[21520,13500,24486,1798]", node.get("shortList").toString()); }
@Override public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream output, @Nonnull Message message) throws IOException { CountingOutputStream wrapper = new CountingOutputStream(output); TTransport transport = new TIOStreamTransport(wrapper); try { TProtocol protocol = protocolFactory.getProtocol(transport); writeMessage(message, protocol); transport.flush(); wrapper.flush(); return wrapper.getByteCount(); } catch (TException e) { throw new SerializerException(e, e.getMessage()); } }
TProtocolSerializer extends Serializer { @Override public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream output, @Nonnull Message message) throws IOException { CountingOutputStream wrapper = new CountingOutputStream(output); TTransport transport = new TIOStreamTransport(wrapper); try { TProtocol protocol = protocolFactory.getProtocol(transport); writeMessage(message, protocol); transport.flush(); wrapper.flush(); return wrapper.getByteCount(); } catch (TException e) { throw new SerializerException(e, e.getMessage()); } } }
TProtocolSerializer extends Serializer { @Override public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream output, @Nonnull Message message) throws IOException { CountingOutputStream wrapper = new CountingOutputStream(output); TTransport transport = new TIOStreamTransport(wrapper); try { TProtocol protocol = protocolFactory.getProtocol(transport); writeMessage(message, protocol); transport.flush(); wrapper.flush(); return wrapper.getByteCount(); } catch (TException e) { throw new SerializerException(e, e.getMessage()); } } TProtocolSerializer(boolean readStrict, TProtocolFactory protocolFactory,
                               boolean binary, String mediaType); }
TProtocolSerializer extends Serializer { @Override public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream output, @Nonnull Message message) throws IOException { CountingOutputStream wrapper = new CountingOutputStream(output); TTransport transport = new TIOStreamTransport(wrapper); try { TProtocol protocol = protocolFactory.getProtocol(transport); writeMessage(message, protocol); transport.flush(); wrapper.flush(); return wrapper.getByteCount(); } catch (TException e) { throw new SerializerException(e, e.getMessage()); } } TProtocolSerializer(boolean readStrict, TProtocolFactory protocolFactory,
                               boolean binary, String mediaType); @Override boolean binaryProtocol(); @Nonnull @Override String mediaType(); @Override int serialize(@Nonnull OutputStream output, @Nonnull Message message); @Override int serialize(@Nonnull OutputStream output, @Nonnull PServiceCall<Message, Field> call); @Nonnull @Override Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message, Field> descriptor); @Nonnull @Override @SuppressWarnings("unchecked") PServiceCall<Message, Field> deserialize(@Nonnull InputStream input, @Nonnull PService service); }
TProtocolSerializer extends Serializer { @Override public <Message extends PMessage<Message, Field>, Field extends PField> int serialize(@Nonnull OutputStream output, @Nonnull Message message) throws IOException { CountingOutputStream wrapper = new CountingOutputStream(output); TTransport transport = new TIOStreamTransport(wrapper); try { TProtocol protocol = protocolFactory.getProtocol(transport); writeMessage(message, protocol); transport.flush(); wrapper.flush(); return wrapper.getByteCount(); } catch (TException e) { throw new SerializerException(e, e.getMessage()); } } TProtocolSerializer(boolean readStrict, TProtocolFactory protocolFactory,
                               boolean binary, String mediaType); @Override boolean binaryProtocol(); @Nonnull @Override String mediaType(); @Override int serialize(@Nonnull OutputStream output, @Nonnull Message message); @Override int serialize(@Nonnull OutputStream output, @Nonnull PServiceCall<Message, Field> call); @Nonnull @Override Message deserialize(@Nonnull InputStream input, @Nonnull PMessageDescriptor<Message, Field> descriptor); @Nonnull @Override @SuppressWarnings("unchecked") PServiceCall<Message, Field> deserialize(@Nonnull InputStream input, @Nonnull PService service);  }