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

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


            synchronized (headerBlockEncoder) {
                SpdySynReplyFrame spdySynReplyFrame = (SpdySynReplyFrame) msg;
                ChannelBuffer data = headerBlockEncoder.encode(spdySynReplyFrame);
                byte flags = spdySynReplyFrame.isLast() ? SPDY_FLAG_FIN : 0;
                int headerBlockLength = data.readableBytes();
                int length;
                if (version < 3) {
                    length = headerBlockLength == 0 ? 8 : 6 + headerBlockLength;
                } else {
                    length = 4 + headerBlockLength;
View Full Code Here


            throws Exception
    {
        channelFuture.setChannel(ctx.getChannel());
        if (e.getMessage() instanceof ChannelBuffer) {
            ChannelBuffer msg = (ChannelBuffer) e.getMessage();
            if (msg.readableBytes() < 8) {
                channelFuture.setFailure(new IOException("invalid sock server reply length = " + msg.readableBytes()));
            }
            // ignore
            msg.readByte();
            int status = msg.readByte();
View Full Code Here

    {
        channelFuture.setChannel(ctx.getChannel());
        if (e.getMessage() instanceof ChannelBuffer) {
            ChannelBuffer msg = (ChannelBuffer) e.getMessage();
            if (msg.readableBytes() < 8) {
                channelFuture.setFailure(new IOException("invalid sock server reply length = " + msg.readableBytes()));
            }
            // ignore
            msg.readByte();
            int status = msg.readByte();
            int port = msg.readShort();
View Full Code Here

        if (finished) {
            return ChannelBuffers.EMPTY_BUFFER;
        }

        ChannelBuffer decompressed = super.encode(frame);
        if (decompressed.readableBytes() == 0) {
            return ChannelBuffers.EMPTY_BUFFER;
        }

        ChannelBuffer compressed = ChannelBuffers.dynamicBuffer();
        setInput(decompressed);
View Full Code Here

                opcode = OPCODE_CONT;
            } else {
                throw new UnsupportedOperationException("Cannot encode frame of type: " + frame.getClass().getName());
            }

            int length = data.readableBytes();

            if (logger.isDebugEnabled()) {
                logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length);
            }
View Full Code Here

        boolean iothread = isIoThread(channel);

        try {
            ChannelBuffer buf = (ChannelBuffer) message;
            int offset = buf.readerIndex();
            int length = buf.readableBytes();
            ByteBuffer nioBuf = buf.toByteBuffer();
            DatagramPacket packet;
            if (nioBuf.hasArray()) {
                // Avoid copy if the buffer is backed by an array.
                packet = new DatagramPacket(
View Full Code Here

                        }
                    }
                }
            } else {
                ChannelBuffer a = (ChannelBuffer) message;
                length = a.readableBytes();
                synchronized (out) {
                    a.getBytes(a.readerIndex(), out, length);
                }
            }
View Full Code Here

        @Override
        public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
            ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
            synchronized (this) {
                buffer.readBytes(out, buffer.readableBytes());
                out.flush();
            }
        }

        @Override
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.