Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.capacity()


        // Try all delimiters.
        for (ChannelBuffer delim: delimiters) {
            int delimIndex = indexOf(buffer, delim);
            if (delimIndex > 0) {
                ChannelBuffer frame = buffer.readBytes(delimIndex);
                if (frame.capacity() > maxFrameLength) {
                    fail();
                }
                buffer.skipBytes(delim.capacity());
                return frame;
            } else if (delimIndex == 0) {
View Full Code Here


                        }
                    }
                    if (result.bytesProduced() > 0) {
                        outNetBuf.flip();
                        msg = ChannelBuffers.buffer(outNetBuf.remaining());
                        msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                        outNetBuf.clear();

                        if (pendingWrite.outAppBuf.hasRemaining()) {
                            // pendingWrite's future shouldn't be notified if
                            // only partial data is written.
View Full Code Here

                result = engine.wrap(EMPTY_BUFFER, outNetBuf);

                if (result.bytesProduced() > 0) {
                    outNetBuf.flip();
                    ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
                    msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                    outNetBuf.clear();
                    if (channel.isConnected()) {
                        future = future(channel);
                        write(ctx, channel, future, msg);
                    }
View Full Code Here

            outAppBuf.flip();

            if (outAppBuf.hasRemaining()) {
                ChannelBuffer frame = ChannelBuffers.buffer(outAppBuf.remaining());
                frame.writeBytes(outAppBuf.array(), 0, frame.capacity());
                return frame;
            } else {
                return null;
            }
        } catch (SSLException e) {
View Full Code Here

                invoke(context, e);
            }
        } else {
            HttpChunk chunk = (HttpChunk) e.getMessage();
        ChannelBuffer cb = chunk.getContent();
        if(cb != null && cb.capacity()>0) {
          cb.getBytes(0, byteContent, receiveLength, cb.capacity());
          this.receiveLength += cb.capacity();
        }
       
            if (chunk.isLast()) {
View Full Code Here

            }
        } else {
            HttpChunk chunk = (HttpChunk) e.getMessage();
        ChannelBuffer cb = chunk.getContent();
        if(cb != null && cb.capacity()>0) {
          cb.getBytes(0, byteContent, receiveLength, cb.capacity());
          this.receiveLength += cb.capacity();
        }
       
            if (chunk.isLast()) {
                readingChunks = false;
View Full Code Here

        } else {
            HttpChunk chunk = (HttpChunk) e.getMessage();
        ChannelBuffer cb = chunk.getContent();
        if(cb != null && cb.capacity()>0) {
          cb.getBytes(0, byteContent, receiveLength, cb.capacity());
          this.receiveLength += cb.capacity();
        }
       
            if (chunk.isLast()) {
                readingChunks = false;
                //content buffer
View Full Code Here

                        }

                        if (result.bytesProduced() > 0) {
                            outNetBuf.flip();
                            msg = ChannelBuffers.buffer(outNetBuf.remaining());
                            msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                            outNetBuf.clear();

                            if (pendingWrite.outAppBuf.hasRemaining()) {
                                // pendingWrite's future shouldn't be notified if
                                // only partial data is written.
View Full Code Here

                }

                if (result.bytesProduced() > 0) {
                    outNetBuf.flip();
                    ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
                    msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
                    outNetBuf.clear();

                    future = future(channel);
                    future.addListener(new ChannelFutureListener() {
                        public void operationComplete(ChannelFuture future)
View Full Code Here

            outAppBuf.flip();

            if (outAppBuf.hasRemaining()) {
                ChannelBuffer frame = ChannelBuffers.buffer(outAppBuf.remaining());
                frame.writeBytes(outAppBuf.array(), 0, frame.capacity());
                return frame;
            } else {
                return null;
            }
        } catch (SSLException e) {
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.