io.netty.buffer.ByteBuf.nioBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中io.netty.buffer.ByteBuf.nioBuffer()方法的一些代码示例,展示了ByteBuf.nioBuffer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.nioBuffer()方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:nioBuffer

ByteBuf.nioBuffer介绍

[英]Exposes this buffer's readable bytes as an NIO ByteBuffer. The returned buffer either share or contains the copied content of this buffer, while changing the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer. This method is identical to buf.nioBuffer(buf.readerIndex(), buf.readableBytes()). This method does not modify readerIndex or writerIndex of this buffer. Please note that the returned NIO buffer will not see the changes of this buffer if this buffer is a dynamic buffer and it adjusted its capacity.
[中]

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public ByteBuffer asByteBuffer(int index, int length) {
  return this.byteBuf.nioBuffer(index, length);
}

代码示例来源:origin: netty/netty

static ByteBuffer safeNioBuffer(ByteBuf buffer) {
    return buffer.nioBufferCount() == 1 ? buffer.internalNioBuffer(buffer.readerIndex(), buffer.readableBytes())
        : buffer.nioBuffer();
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public ByteBuffer asByteBuffer() {
  return this.byteBuf.nioBuffer();
}

代码示例来源:origin: redisson/redisson

static ByteBuffer safeNioBuffer(ByteBuf buffer) {
    return buffer.nioBufferCount() == 1 ? buffer.internalNioBuffer(buffer.readerIndex(), buffer.readableBytes())
        : buffer.nioBuffer();
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public ByteBuffer toByteBuffer() {
  return buffer.nioBuffer();
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  checkIndex(index, length);
  if (buffers.length == 1) {
    ByteBuf buf = buffer(0);
    if (buf.nioBufferCount() == 1) {
      return buf.nioBuffer(index, length);
    }
  }
  ByteBuffer merged = ByteBuffer.allocate(length).order(order());
  ByteBuffer[] buffers = nioBuffers(index, length);
  //noinspection ForLoopReplaceableByForEach
  for (int i = 0; i < buffers.length; i++) {
    merged.put(buffers[i]);
  }
  merged.flip();
  return merged;
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public ByteBuffer toByteBuffer(int index, int length) {
  return buffer.nioBuffer(index, length);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer() {
  return buf.nioBuffer();
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  return buf.nioBuffer(index, length);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer() {
  return buf.nioBuffer().order(order);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  return buf.nioBuffer(index, length).order(order);
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuffer nioBuffer(int index, int length) {
  return buf.nioBuffer(index, length).order(order);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public Collection<Message<P>> decode(ByteBuf inputBuffer) {
  ByteBuffer nioBuffer = inputBuffer.nioBuffer();
  int start = nioBuffer.position();
  List<Message<P>> messages = decodeInternal(nioBuffer);
  inputBuffer.skipBytes(nioBuffer.position() - start);
  return messages;
}

代码示例来源:origin: netty/netty

@Override
  public ByteBuffer nioBuffer(int index, int length) {
    return unwrap().nioBuffer(index, length);
  }
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  checkIndex(index, length);
  return buffer.nioBuffer(index, length);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  return unwrap().nioBuffer(index, length).asReadOnlyBuffer();
}

代码示例来源:origin: redisson/redisson

@Override
  public ByteBuffer nioBuffer(int index, int length) {
    return unwrap().nioBuffer(index, length);
  }
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuffer nioBuffer(int index, int length) {
  checkIndex(index, length);
  return buffer.nioBuffer(index, length);
}

代码示例来源:origin: netty/netty

@Override
public ByteBuffer nioBuffer(int index, int length) {
  checkIndex0(index, length);
  return unwrap().nioBuffer(idx(index), length);
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuffer nioBuffer(int index, int length) {
  checkIndex0(index, length);
  return unwrap().nioBuffer(idx(index), length);
}

相关文章

ByteBuf类方法