Examples of DynamicChannelBuffer


Examples of com.facebook.presto.jdbc.internal.netty.buffer.DynamicChannelBuffer

        //
        // set body
        BodyGenerator bodyGenerator = request.getBodyGenerator();
        if (bodyGenerator != null) {
            DynamicChannelBuffer content = new DynamicChannelBuffer(64 * 1024);
            ChannelBufferOutputStream out = new ChannelBufferOutputStream(content);
            bodyGenerator.write(out);

            nettyRequest.setHeader(Names.CONTENT_LENGTH, content.readableBytes());
            nettyRequest.setContent(content);
        }
        return nettyRequest;
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

{
  private final ChannelBuffer _buffer;

  public SimpleResponseBytesAggregatorHandler(ByteOrder byteOrder)
  {
    _buffer = new DynamicChannelBuffer(byteOrder, 1000);
  }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

  {
    private final ChannelBuffer _buffer;

    public SimpleResponseBytesAggregatorHandler(ByteOrder byteOrder)
    {
      _buffer = new DynamicChannelBuffer(byteOrder, 1000);
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

    private ChannelBuffer buf;

    @Before
    public void startUp() {
        byte[] bytes = PAYLOAD.getBytes();
        buf = new DynamicChannelBuffer(bytes.length);
        buf.writeBytes(bytes);
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

        return new ObjectInputStream(is);
    }

    @Converter
    public static ChannelBuffer toByteBuffer(byte[] bytes) {
        ChannelBuffer buf = new DynamicChannelBuffer(bytes.length);
        buf.writeBytes(bytes);
        return buf;
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

        return new ObjectInputStream(is);
    }

    @Converter
    public static ChannelBuffer toByteBuffer(byte[] bytes) {
        ChannelBuffer buf = new DynamicChannelBuffer(bytes.length);

        buf.writeBytes(bytes);
        return buf;
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

        return new ObjectInputStream(is);
    }

    @Converter
    public static ChannelBuffer toByteBuffer(byte[] bytes) {
        ChannelBuffer buf = new DynamicChannelBuffer(bytes.length);

        buf.writeBytes(bytes);
        return buf;
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

    @Override
    protected Object encode(ChannelHandlerContext ctx, Channel channel,
                            Object message) throws Exception {
        if (message instanceof SyncMessage) {
            ChannelBuffer buf = new DynamicChannelBuffer(512);
            ChannelBufferOutputStream os = new ChannelBufferOutputStream(buf);
            TCompactProtocol thriftProtocol =
                    new TCompactProtocol(new TIOStreamTransport(os));
            ((SyncMessage) message).write(thriftProtocol);

            ChannelBuffer len = ChannelBuffers.buffer(4);
            len.writeInt(buf.readableBytes());
            return ChannelBuffers.wrappedBuffer(len, buf);
        }
        return message;
    }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

  @Test
  public void testCodePerformance() throws Exception {
    MessageCodec codec = lookup(MessageCodec.class, ID);
    MessageTree tree = buildMessage();
    ChannelBuffer buf = new DynamicChannelBuffer(10240);
    codec.encode(tree, buf);

    int count = 5000000;
    for (int i = 0; i < count; i++) {

      buf.markReaderIndex();
      // read the size of the message
      buf.readInt();
      DefaultMessageTree result = (DefaultMessageTree) codec.decode(buf);
      buf.resetReaderIndex();
      result.setBuffer(buf);
    }
  }
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

  @Test
  public void testCodePerformance() throws Exception {
    MessageCodec codec = lookup(MessageCodec.class, ID);
    MessageTree tree = buildMessage();
    ChannelBuffer buf = new DynamicChannelBuffer(10240);
    codec.encode(tree, buf);
    MessageTree result = new DefaultMessageTree();
    codec.decode(buf, result);
    Assert.assertEquals(tree.toString(), result.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.