Package com.facebook.presto.jdbc.internal.netty.buffer

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


                size -= buffer.readableBytes() + 1;
            } else {
                currentBuffer = ChannelBuffers.wrappedBuffer(currentBuffer,
                    buffer, ChannelBuffers.wrappedBuffer("=".getBytes()));
                //continue
                size -= buffer.readableBytes() + 1;
            }
            if (currentBuffer.readableBytes() >= HttpPostBodyUtil.chunkSize) {
                buffer = fillChannelBuffer();
                return new DefaultHttpChunk(buffer);
            }
View Full Code Here


                spdyHeadersFrame = null;
                Channels.fireExceptionCaught(ctx, e);
                return null;
            }

            int readBytes = compressedBytes - compressed.readableBytes();
            buffer.skipBytes(readBytes);
            length -= readBytes;

            if (spdyHeadersFrame != null &&
                    (spdyHeadersFrame.isInvalid() || spdyHeadersFrame.isTruncated())) {
View Full Code Here

                    // Replace the content.
                    m.setContent(content);
                    if (m.containsHeader(HttpHeaders.Names.CONTENT_LENGTH)) {
                        m.setHeader(
                                HttpHeaders.Names.CONTENT_LENGTH,
                                Integer.toString(content.readableBytes()));
                    }
                }
            }

            // Because HttpMessage is a mutable object, we can simply forward the received event.
View Full Code Here

        } else {
            this.delimiters = new ChannelBuffer[delimiters.length];
            for (int i = 0; i < delimiters.length; i ++) {
                ChannelBuffer d = delimiters[i];
                validateDelimiter(d);
                this.delimiters[i] = d.slice(d.readerIndex(), d.readableBytes());
            }
            lineBasedDecoder = null;
        }
        this.maxFrameLength = maxFrameLength;
        this.stripDelimiter = stripDelimiter;
View Full Code Here

            if (httpMessage == null) {
                return null;
            }

            ChannelBuffer content = httpMessage.getContent();
            if (content.readableBytes() > maxContentLength - spdyDataFrame.getData().readableBytes()) {
                removeMessage(streamId);
                throw new TooLongFrameException(
                        "HTTP content length exceeded " + maxContentLength + " bytes.");
            }
View Full Code Here

            return msg;
        }

        ChannelBuffer src = (ChannelBuffer) msg;
        return Base64.encode(
                src, src.readerIndex(), src.readableBytes(),
                breakLines, dialect);
    }
}
View Full Code Here

            } else {
                content.writeBytes(spdyDataFrame.getData());
            }

            if (spdyDataFrame.isLast()) {
                HttpHeaders.setContentLength(httpMessage, content.readableBytes());
                removeMessage(streamId);
                return httpMessage;
            }

        } else if (msg instanceof SpdyRstStreamFrame) {
View Full Code Here

            return msg;
        }

        ChannelBuffer src = (ChannelBuffer) msg;
        return Base64.decode(
                src, src.readerIndex(), src.readableBytes(), dialect);
    }

}
View Full Code Here

        // Otherwise, all messages are encrypted.
        ChannelBuffer msg = (ChannelBuffer) e.getMessage();
        PendingWrite pendingWrite;

        if (msg.readable()) {
            pendingWrite = new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes()));
        } else {
            pendingWrite = new PendingWrite(evt.getFuture(), null);
        }

        pendingUnencryptedWritesLock.lock();
View Full Code Here

                ChannelBuffer data = headerBlockEncoder.encode(spdySynStreamFrame);
                byte flags = spdySynStreamFrame.isLast() ? SPDY_FLAG_FIN : 0;
                if (spdySynStreamFrame.isUnidirectional()) {
                    flags |= SPDY_FLAG_UNIDIRECTIONAL;
                }
                int headerBlockLength = data.readableBytes();
                int length;
                if (version < 3) {
                    length = headerBlockLength == 0 ? 12 : 10 + headerBlockLength;
                } else {
                    length = 10 + headerBlockLength;
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.