本文整理了Java中io.netty.buffer.ByteBuf.nioBufferCount()
方法的一些代码示例,展示了ByteBuf.nioBufferCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.nioBufferCount()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:nioBufferCount
[英]Returns the maximum number of NIO ByteBuffers that consist this buffer. Note that #nioBuffers()or #nioBuffers(int,int) might return a less number of ByteBuffers.
[中]返回组成此缓冲区的NIO字节缓冲区的最大数目。请注意,#nioBuffers()或#nioBuffers(int,int)可能返回较少的ByteBuffers。
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return buf.nioBufferCount();
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return buffer.nioBufferCount();
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return buf.nioBufferCount();
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
int size = componentCount;
switch (size) {
case 0:
return 1;
case 1:
return components[0].buf.nioBufferCount();
default:
int count = 0;
for (int i = 0; i < size; i++) {
count += components[i].buf.nioBufferCount();
}
return count;
}
}
代码示例来源:origin: redisson/redisson
@Override
public int nioBufferCount() {
return buf.nioBufferCount();
}
代码示例来源:origin: netty/netty
static ByteBuffer safeNioBuffer(ByteBuf buffer) {
return buffer.nioBufferCount() == 1 ? buffer.internalNioBuffer(buffer.readerIndex(), buffer.readableBytes())
: buffer.nioBuffer();
}
}
代码示例来源:origin: netty/netty
/**
* Checks if the specified buffer is a direct buffer and is composed of a single NIO buffer.
* (We check this because otherwise we need to make it a non-composite buffer.)
*/
private static boolean isSingleDirectBuffer(ByteBuf buf) {
return buf.isDirect() && buf.nioBufferCount() == 1;
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return unwrap().nioBufferCount();
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return unwrap().nioBufferCount();
}
代码示例来源:origin: netty/netty
@Override
public int nioBufferCount() {
return unwrap().nioBufferCount();
}
代码示例来源:origin: redisson/redisson
static ByteBuffer safeNioBuffer(ByteBuf buffer) {
return buffer.nioBufferCount() == 1 ? buffer.internalNioBuffer(buffer.readerIndex(), buffer.readableBytes())
: buffer.nioBuffer();
}
}
代码示例来源:origin: redisson/redisson
/**
* Checks if the specified buffer is a direct buffer and is composed of a single NIO buffer.
* (We check this because otherwise we need to make it a non-composite buffer.)
*/
private static boolean isSingleDirectBuffer(ByteBuf buf) {
return buf.isDirect() && buf.nioBufferCount() == 1;
}
代码示例来源:origin: redisson/redisson
@Override
public int nioBufferCount() {
return unwrap().nioBufferCount();
}
代码示例来源:origin: redisson/redisson
@Override
public int nioBufferCount() {
return unwrap().nioBufferCount();
}
代码示例来源: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: netty/netty
@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
checkSrcIndex(index, length, srcIndex, src.capacity());
if (src.nioBufferCount() > 0) {
for (ByteBuffer bb: src.nioBuffers(srcIndex, length)) {
int bbLen = bb.remaining();
setBytes(index, bb);
index += bbLen;
}
} else {
src.getBytes(srcIndex, this, index, length);
}
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
checkDstIndex(index, length, dstIndex, dst.capacity());
if (dst.hasArray()) {
getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
} else if (dst.nioBufferCount() > 0) {
for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
int bbLen = bb.remaining();
getBytes(index, bb);
index += bbLen;
}
} else {
dst.setBytes(dstIndex, this, index, length);
}
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
checkDstIndex(index, length, dstIndex, dst.capacity());
if (dst.hasArray()) {
getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
} else if (dst.nioBufferCount() > 0) {
for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
int bbLen = bb.remaining();
getBytes(index, bb);
index += bbLen;
}
} else {
dst.setBytes(dstIndex, this, index, length);
}
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
checkDstIndex(index, length, dstIndex, dst.capacity());
if (dst.hasArray()) {
getBytes(index, dst.array(), dst.arrayOffset() + dstIndex, length);
} else if (dst.nioBufferCount() > 0) {
for (ByteBuffer bb: dst.nioBuffers(dstIndex, length)) {
int bbLen = bb.remaining();
getBytes(index, bb);
index += bbLen;
}
} else {
dst.setBytes(dstIndex, this, index, length);
}
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
checkSrcIndex(index, length, srcIndex, src.capacity());
if (src.hasArray()) {
setBytes(index, src.array(), src.arrayOffset() + srcIndex, length);
} else if (src.nioBufferCount() > 0) {
for (ByteBuffer bb: src.nioBuffers(srcIndex, length)) {
int bbLen = bb.remaining();
setBytes(index, bb);
index += bbLen;
}
} else {
src.getBytes(srcIndex, this, index, length);
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!