Package io.netty.buffer

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


    Objects.requireNonNull(buffer, "buffer");
    Objects.requireNonNull(handler, "handler");
    Arguments.require(position >= 0, "position must be >= 0");
    check();
    ByteBuf buf = buffer.getByteBuf();
    if (buf.nioBufferCount() > 1) {
      Iterator<ByteBuffer> buffers = Arrays.asList(buf.nioBuffers()).iterator();
      doWrite(buffers, position, handler);
    } else {
      ByteBuffer bb = buf.nioBuffer();
      doWrite(bb, position, bb.limit(),  handler);
View Full Code Here


        handleException(ar.cause());
      }
    };

    ByteBuf buf = buffer.getByteBuf();
    if (buf.nioBufferCount() > 1) {
      Iterator<ByteBuffer> buffers = Arrays.asList(buf.nioBuffers()).iterator();
      doWrite(buffers, writePos, handler);
    } else {
      ByteBuffer bb = buf.nioBuffer();
      doWrite(bb, writePos, bb.limit(), handler);
View Full Code Here

                if (readableBytes > 0) {
                    nioBufferSize += readableBytes;
                    int count = entry.count;
                    if (count == -1) {
                        //noinspection ConstantValueVariableUse
                        entry.count = count =  buf.nioBufferCount();
                    }
                    int neededSpace = nioBufferCount + count;
                    if (neededSpace > nioBuffers.length) {
                        nioBuffers = expandNioBufferArray(nioBuffers, neededSpace, nioBufferCount);
                        NIO_BUFFERS.set(threadLocalMap, nioBuffers);
View Full Code Here

  @Override
  public ByteBuffer nioBuffer(int index, int length) {
    if (components.size() == 1) {
      ByteBuf buf = components.get(0).buf;
      if (buf.nioBufferCount() == 1) {
        return components.get(0).buf.nioBuffer(index, length);
      }
    }
    ByteBuffer merged = ByteBuffer.allocate(length).order(order());
    ByteBuffer[] buffers = nioBuffers(index, length);
View Full Code Here

      Component c = components.get(i);
      ByteBuf s = c.buf;
      int adjustment = c.offset;
      int localLength = Math.min(length, s.readableBytes()
          - (index - adjustment));
      switch (s.nioBufferCount()) {
      case 0:
        throw new UnsupportedOperationException();
      case 1:
        buffers.add(s.nioBuffer(index - adjustment, localLength));
        break;
View Full Code Here

                if (readableBytes > 0) {
                    nioBufferSize += readableBytes;
                    int count = entry.count;
                    if (count == -1) {
                        //noinspection ConstantValueVariableUse
                        entry.count = count =  buf.nioBufferCount();
                    }
                    int neededSpace = nioBufferCount + count;
                    if (neededSpace > nioBuffers.length) {
                        nioBuffers = expandNioBufferArray(nioBuffers, neededSpace, nioBufferCount);
                        NIO_BUFFERS.set(threadLocalMap, nioBuffers);
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.