Examples of readableBytes()


Examples of com.alibaba.dubbo.remoting.buffer.ChannelBuffer.readableBytes()

           
            Object msg = context.getMessage();
            codec.encode(channel, channelBuffer, msg);
           
            GrizzlyChannel.removeChannelIfDisconnectd(connection);
            Buffer buffer = connection.getTransport().getMemoryManager().allocate(channelBuffer.readableBytes());
            buffer.put(channelBuffer.toByteBuffer());
            buffer.flip();
            buffer.allowBufferDispose(true);
            context.setMessage(buffer);
        } finally {
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.readableBytes()

        } else {
            flags |= SERIALIZED;
            encoded.writeBytes(serialize(content));
        }

        if (encoded.readableBytes() >= compressionThreshold) {
            byte[] compressed = compress(encoded.copy().array());
            if (compressed.length < encoded.array().length) {
                encoded.clear().writeBytes(compressed);
                flags |= COMPRESSED;
            }
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.buffer.ChannelBuffer.readableBytes()

        ChannelBuffer result;
        synchronized (z) {
            try {
                // Configure input.
                ChannelBuffer uncompressed = (ChannelBuffer) msg;
                byte[] in = new byte[uncompressed.readableBytes()];
                uncompressed.readBytes(in);
                z.next_in = in;
                z.next_in_index = 0;
                z.avail_in = in.length;
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.buffer.CompositeChannelBuffer.readableBytes()

            // Make sure the resulting cumulation buffer has no more than the configured components.
            CompositeChannelBuffer composite = (CompositeChannelBuffer) cumulation;
            if (composite.numComponents() >= maxCumulationBufferComponents) {
                currentMessage.setContent(ChannelBuffers.wrappedBuffer(composite.copy(), input));
            } else {
                List<ChannelBuffer> decomposed = composite.decompose(0, composite.readableBytes());
                ChannelBuffer[] buffers = decomposed.toArray(new ChannelBuffer[decomposed.size() + 1]);
                buffers[buffers.length - 1] = input;

                currentMessage.setContent(ChannelBuffers.wrappedBuffer(buffers));
            }
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.buffer.DynamicChannelBuffer.readableBytes()

        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 com.impossibl.postgres.utils.NullByteBuf.readableBytes()

    // Compute length using null channel buffer
    NullByteBuf lengthComputer = new NullByteBuf();
    codec.encoder.encode(type, lengthComputer, val, conn);

    assertEquals(typeName + " computes length incorrectly", lengthComputer.readableBytes(), length);
  }

  private void assertStreamEquals(InputStream expected, InputStream actual) throws IOException {
    expected.reset();
    actual.reset();
View Full Code Here

Examples of io.netty.buffer.ByteBuf.readableBytes()

    @Override
    public DelegationTransfer transfer(TransferBuffer buffer) {
      ByteBuf buf = ByteBuf.class.cast(buffer.getBuffer());
      try {
        this.lock.lock();
        int readable = buf.readableBytes();
        buf.readBytes(this.output, readable);
        this.readable.addAndGet(readable);
        return this;
      } catch (Exception e) {
        DegelationTransferBuilder.this.log.error(e);
View Full Code Here

Examples of io.netty.buffer.ByteBuf.readableBytes()

            // We just need to reset the readerIndex this time
            if (buffer.readerIndex() == buffer.writerIndex()) {
                buffer.setIndex(0, buffer.writerIndex());
            }
            // TODO How to enable the chunk transport
            int len = buffer.readableBytes();
            // set content-length
            response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, len);
            LOG.trace("Content-Length: {}", len);
        } else {
            response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(code));
View Full Code Here

Examples of io.netty.buffer.ByteBuf.readableBytes()

                    buffer = NettyConverter.toByteBuffer(data);
                }
            }
            if (buffer != null) {
                request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, buffer);
                int len = buffer.readableBytes();
                // set content-length
                request.headers().set(HttpHeaders.Names.CONTENT_LENGTH, len);
                LOG.trace("Content-Length: {}", len);
            } else {
                // we do not support this kind of body
View Full Code Here

Examples of io.netty.buffer.ByteBuf.readableBytes()

            httpRequest.headers().add(HttpHeaders.Names.HOST, NettyConnector.this.host);
            if (cookie != null)
            {
               httpRequest.headers().add(HttpHeaders.Names.COOKIE, cookie);
            }
            httpRequest.headers().add(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buf.readableBytes()));
            ctx.write(httpRequest, promise);
            lastSendTime = System.currentTimeMillis();
         }
         else
         {
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.