本文整理了Java中org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf.readBoolean()
方法的一些代码示例,展示了ByteBuf.readBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.readBoolean()
方法的具体详情如下:
包路径:org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:readBoolean
暂无
代码示例来源:origin: com.alibaba.blink/flink-runtime
static ErrorResponse readFrom(ByteBuf buffer) throws Exception {
try (ObjectInputStream ois = new ObjectInputStream(new ByteBufInputStream(buffer))) {
Object obj = ois.readObject();
if (!(obj instanceof Throwable)) {
throw new ClassCastException("Read object expected to be of type Throwable, " +
"actual type is " + obj.getClass() + ".");
} else {
if (buffer.readBoolean()) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
return new ErrorResponse((Throwable) obj, receiverId);
} else {
return new ErrorResponse((Throwable) obj);
}
}
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
static ErrorResponse readFrom(ByteBuf buffer) throws Exception {
try (ObjectInputStream ois = new ObjectInputStream(new ByteBufInputStream(buffer))) {
Object obj = ois.readObject();
if (!(obj instanceof Throwable)) {
throw new ClassCastException("Read object expected to be of type Throwable, " +
"actual type is " + obj.getClass() + ".");
} else {
if (buffer.readBoolean()) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
return new ErrorResponse((Throwable) obj, receiverId);
} else {
return new ErrorResponse((Throwable) obj);
}
}
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
static ErrorResponse readFrom(ByteBuf buffer) throws Exception {
try (ObjectInputStream ois = new ObjectInputStream(new ByteBufInputStream(buffer))) {
Object obj = ois.readObject();
if (!(obj instanceof Throwable)) {
throw new ClassCastException("Read object expected to be of type Throwable, " +
"actual type is " + obj.getClass() + ".");
} else {
if (buffer.readBoolean()) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
return new ErrorResponse((Throwable) obj, receiverId);
} else {
return new ErrorResponse((Throwable) obj);
}
}
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
static BufferResponse readFrom(ByteBuf buffer) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
int sequenceNumber = buffer.readInt();
int backlog = buffer.readInt();
boolean isBuffer = buffer.readBoolean();
int size = buffer.readInt();
ByteBuf retainedSlice = buffer.readSlice(size).retain();
return new BufferResponse(retainedSlice, isBuffer, sequenceNumber, receiverId, backlog);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
static BufferResponse readFrom(ByteBuf buffer) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
int sequenceNumber = buffer.readInt();
int backlog = buffer.readInt();
boolean isBuffer = buffer.readBoolean();
int size = buffer.readInt();
ByteBuf retainedSlice = buffer.readSlice(size).retain();
return new BufferResponse(retainedSlice, isBuffer, sequenceNumber, receiverId, backlog);
}
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Parses the whole BufferResponse message and composes a new BufferResponse with both header parsed and
* data buffer filled in. This method is used in non-credit-based network stack.
*
* @param buffer the whole serialized BufferResponse message.
* @return a BufferResponse object with the header parsed and the data buffer filled in.
*/
static BufferResponse readFrom(ByteBuf buffer) {
InputChannelID receiverId = InputChannelID.fromByteBuf(buffer);
int sequenceNumber = buffer.readInt();
int backlog = buffer.readInt();
boolean isBuffer = buffer.readBoolean();
int size = buffer.readInt();
ByteBuf retainedSlice = buffer.readSlice(size).retain();
return new BufferResponse(retainedSlice, isBuffer, sequenceNumber, receiverId, backlog, size);
}
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
/**
* Parses the message header part and composes a new BufferResponse with an empty data buffer. The
* data buffer will be filled in later. This method is used in credit-based network stack.
*
* @param messageHeader the serialized message header.
* @param bufferAllocator the allocator for network buffer.
* @return a BufferResponse object with the header parsed and the data buffer to fill in later.
*/
static BufferResponse readFrom(ByteBuf messageHeader, NetworkBufferAllocator bufferAllocator) {
InputChannelID receiverId = InputChannelID.fromByteBuf(messageHeader);
int sequenceNumber = messageHeader.readInt();
int backlog = messageHeader.readInt();
boolean isBuffer = messageHeader.readBoolean();
int size = messageHeader.readInt();
Buffer dataBuffer = null;
if (size != 0) {
if (isBuffer) {
dataBuffer = bufferAllocator.allocatePooledNetworkBuffer(receiverId, size);
} else {
dataBuffer = bufferAllocator.allocateUnPooledNetworkBuffer(size);
}
}
return new BufferResponse(dataBuffer == null ? null : dataBuffer.asByteBuf(),
isBuffer,
sequenceNumber,
receiverId,
backlog,
size);
}
内容来源于网络,如有侵权,请联系作者删除!