本文整理了Java中io.netty.buffer.ByteBuf.isDirect()
方法的一些代码示例,展示了ByteBuf.isDirect()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.isDirect()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:isDirect
[英]Returns true if and only if this buffer is backed by an NIO direct buffer.
[中]当且仅当此缓冲区由NIO直接缓冲区支持时,返回true。
代码示例来源:origin: apache/incubator-dubbo
@Override
public boolean isDirect() {
return buffer.isDirect();
}
代码示例来源:origin: netty/netty
@Override
public final boolean isDirect() {
return buf.isDirect();
}
代码示例来源:origin: netty/netty
@Override
public boolean isDirect() {
return buffer.isDirect();
}
代码示例来源:origin: netty/netty
@Override
public boolean isDirect() {
return buf.isDirect();
}
代码示例来源:origin: netty/netty
@Override
public boolean isDirect() {
int size = componentCount;
if (size == 0) {
return false;
}
for (int i = 0; i < size; i++) {
if (!components[i].buf.isDirect()) {
return false;
}
}
return true;
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isDirect() {
int size = componentCount;
if (size == 0) {
return false;
}
for (int i = 0; i < size; i++) {
if (!components[i].buf.isDirect()) {
return false;
}
}
return true;
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isDirect() {
return buffer.isDirect();
}
代码示例来源:origin: redisson/redisson
@Override
public final boolean isDirect() {
return buf.isDirect();
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isDirect() {
return buf.isDirect();
}
代码示例来源: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 boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源:origin: netty/netty
@Override
public boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源:origin: netty/netty
@Override
public boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源: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 boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源:origin: redisson/redisson
@Override
public boolean isDirect() {
return unwrap().isDirect();
}
代码示例来源:origin: netty/netty
@Override
protected final Object filterOutboundMessage(Object msg) {
if (msg instanceof ByteBuf) {
ByteBuf buf = (ByteBuf) msg;
if (buf.isDirect()) {
return msg;
}
return newDirectBuffer(buf);
}
if (msg instanceof FileRegion) {
return msg;
}
throw new UnsupportedOperationException(
"unsupported message type: " + StringUtil.simpleClassName(msg) + EXPECTED_TYPES);
}
代码示例来源:origin: redisson/redisson
static long memoryAddress(ByteBuf buf) {
assert buf.isDirect();
return buf.hasMemoryAddress() ? buf.memoryAddress() : Buffer.address(buf.nioBuffer());
}
代码示例来源:origin: eclipse-vertx/vert.x
public void handleMessage(Object msg) {
if (msg instanceof DatagramPacket) {
DatagramPacket packet = (DatagramPacket) msg;
ByteBuf content = packet.content();
if (content.isDirect()) {
content = VertxHandler.safeBuffer(content, chctx.alloc());
}
handlePacket(new DatagramPacketImpl(packet.sender(), Buffer.buffer(content)));
}
}
内容来源于网络,如有侵权,请联系作者删除!