Package org.jboss.netty.buffer

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


        }

        nfamilies++;
        writeByteArray(buf, family)// The column family.

        nkeys_per_family_index = buf.writerIndex();
        // Number of "KeyValues" that follow.
        buf.writeInt(0)// We'll monkey patch this later.
        if (rpc.code() == PutRequest.CODE) {
          // Total number of bytes taken by those "KeyValues".
          // This is completely useless and only done for `Put'.
View Full Code Here


                try {
                    for (int i = writeSpinCount; i > 0; i --) {
                        int localWrittenBytes = buf.getBytes(
                            bufIdx,
                            channel.socket,
                            buf.writerIndex() - bufIdx);

                        if (localWrittenBytes != 0) {
                            bufIdx += localWrittenBytes;
                            break;
                        }
View Full Code Here

                            bufIdx += localWrittenBytes;
                            break;
                        }
                    }

                    if (bufIdx == buf.writerIndex()) {
                        // Successful write - proceed to the next message.
                        evt.getFuture().setSuccess();
                        evt = null;
                    } else {
                        // Not written fully - perhaps the kernel buffer is full.
View Full Code Here

                        int localWrittenBytes = buf.getBytes(
                            bufIdx,
                            channel.socket,
                            Math.min(
                                    maxWrittenBytes - writtenBytes,
                                    buf.writerIndex() - bufIdx));

                        if (localWrittenBytes != 0) {
                            writtenBytes += localWrittenBytes;
                            bufIdx += localWrittenBytes;
                            break;
View Full Code Here

                            bufIdx += localWrittenBytes;
                            break;
                        }
                    }

                    if (bufIdx == buf.writerIndex()) {
                        // Successful write - proceed to the next message.
                        evt.getFuture().setSuccess();
                        evt = null;
                    } else {
                        // Not written fully - perhaps the kernel buffer is full.
View Full Code Here

            {
               httpRequest.addHeader(HttpHeaders.Names.COOKIE, cookie);
            }
            ChannelBuffer buf = (ChannelBuffer)e.getMessage();
            httpRequest.setContent(buf);
            httpRequest.addHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buf.writerIndex()));
            Channels.write(ctx, e.getFuture(), httpRequest, e.getRemoteAddress());
            lastSendTime = System.currentTimeMillis();
         }
         else
         {
View Full Code Here

                try {
                    for (int i = channel.getConfig().getWriteSpinCount(); i > 0; i --) {
                        localWrittenBytes = a.getBytes(
                            channel.currentWriteIndex,
                            channel.socket,
                            Math.min(maxWrittenBytes - writtenBytes, a.writerIndex() - channel.currentWriteIndex));
                        if (localWrittenBytes != 0) {
                            break;
                        }
                    }
                } catch (Throwable t) {
View Full Code Here

                    fireExceptionCaught(channel, t);
                }

                writtenBytes += localWrittenBytes;
                channel.currentWriteIndex += localWrittenBytes;
                if (channel.currentWriteIndex == a.writerIndex()) {
                    // Successful write - proceed to the next message.
                    channel.currentWriteEvent.getFuture().setSuccess();
                    channel.currentWriteEvent = null;
                } else {
                    // Not written fully - perhaps the kernel buffer is full.
View Full Code Here

    public String read(Context ctx, byte separator) {
      ChannelBuffer buf = ctx.getBuffer();
      char[] data = ctx.getData();
      int from = buf.readerIndex();
      int to = buf.writerIndex();
      int index = 0;
      boolean flag = false;

      for (int i = from; i < to; i++) {
        byte b = buf.readByte();
View Full Code Here

        writeLengthField(headerBlock, numHeaders);
        for (String name: names) {
            byte[] nameBytes = name.getBytes("UTF-8");
            writeLengthField(headerBlock, nameBytes.length);
            headerBlock.writeBytes(nameBytes);
            int savedIndex = headerBlock.writerIndex();
            int valueLength = 0;
            writeLengthField(headerBlock, valueLength);
            for (String value: headerFrame.getHeaders(name)) {
                byte[] valueBytes = value.getBytes("UTF-8");
                if (valueBytes.length > 0) {
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.