本文整理了Java中io.netty.buffer.ByteBuf.markWriterIndex()
方法的一些代码示例,展示了ByteBuf.markWriterIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.markWriterIndex()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:markWriterIndex
[英]Marks the current writerIndex in this buffer. You can reposition the current writerIndex to the marked writerIndex by calling #resetWriterIndex(). The initial value of the marked writerIndex is 0.
[中]标记此缓冲区中的当前writerIndex。通过调用#resetWriterIndex(),可以将当前writerIndex重新定位到标记的writerIndex。标记的writerIndex的初始值为0。
代码示例来源:origin: apache/incubator-dubbo
@Override
public void markWriterIndex() {
buffer.markWriterIndex();
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public final ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public final ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public final ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public final ByteBuf markWriterIndex() {
byteBuf.markWriterIndex();
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public void markWriterIndex() {
buffer.markWriterIndex();
}
代码示例来源:origin: fengjiachun/Jupiter
private ByteBuf doEncodeRequest(JRequestPayload request) {
byte sign = JProtocolHeader.toSign(request.serializerCode(), JProtocolHeader.REQUEST);
long invokeId = request.invokeId();
ByteBuf byteBuf = (ByteBuf) request.outputBuf().backingObject();
int length = byteBuf.readableBytes();
byteBuf.markWriterIndex();
byteBuf.writerIndex(byteBuf.writerIndex() - length);
byteBuf.writeShort(JProtocolHeader.MAGIC)
.writeByte(sign)
.writeByte(0x00)
.writeLong(invokeId)
.writeInt(length - JProtocolHeader.HEADER_SIZE);
byteBuf.resetWriterIndex();
return byteBuf;
}
代码示例来源:origin: fengjiachun/Jupiter
private ByteBuf doEncodeRequest(JRequestPayload request) {
byte sign = JProtocolHeader.toSign(request.serializerCode(), JProtocolHeader.REQUEST);
long invokeId = request.invokeId();
ByteBuf byteBuf = (ByteBuf) request.outputBuf().backingObject();
int length = byteBuf.readableBytes();
byteBuf.markWriterIndex();
byteBuf.writerIndex(byteBuf.writerIndex() - length);
byteBuf.writeShort(JProtocolHeader.MAGIC)
.writeByte(sign)
.writeByte(0x00)
.writeLong(invokeId)
.writeInt(length - JProtocolHeader.HEADER_SIZE);
byteBuf.resetWriterIndex();
return byteBuf;
}
代码示例来源:origin: fengjiachun/Jupiter
private ByteBuf doEncodeResponse(JResponsePayload response) {
byte sign = JProtocolHeader.toSign(response.serializerCode(), JProtocolHeader.RESPONSE);
byte status = response.status();
long invokeId = response.id();
ByteBuf byteBuf = (ByteBuf) response.outputBuf().backingObject();
int length = byteBuf.readableBytes();
byteBuf.markWriterIndex();
byteBuf.writerIndex(byteBuf.writerIndex() - length);
byteBuf.writeShort(JProtocolHeader.MAGIC)
.writeByte(sign)
.writeByte(status)
.writeLong(invokeId)
.writeInt(length - JProtocolHeader.HEADER_SIZE);
byteBuf.resetWriterIndex();
return byteBuf;
}
}
代码示例来源:origin: fengjiachun/Jupiter
private ByteBuf doEncodeResponse(JResponsePayload response) {
byte sign = JProtocolHeader.toSign(response.serializerCode(), JProtocolHeader.RESPONSE);
byte status = response.status();
long invokeId = response.id();
ByteBuf byteBuf = (ByteBuf) response.outputBuf().backingObject();
int length = byteBuf.readableBytes();
byteBuf.markWriterIndex();
byteBuf.writerIndex(byteBuf.writerIndex() - length);
byteBuf.writeShort(JProtocolHeader.MAGIC)
.writeByte(sign)
.writeByte(status)
.writeLong(invokeId)
.writeInt(length - JProtocolHeader.HEADER_SIZE);
byteBuf.resetWriterIndex();
return byteBuf;
}
}
代码示例来源:origin: lettuce-io/lettuce-core
private void encode(ChannelHandlerContext ctx, ByteBuf out, RedisCommand<?, ?, ?> command) {
try {
out.markWriterIndex();
command.encode(out);
} catch (RuntimeException e) {
out.resetWriterIndex();
command.completeExceptionally(new EncoderException(
"Cannot encode command. Please close the connection as the connection state may be out of sync.",
e));
}
if (debugEnabled) {
logger.debug("{} writing command {}", logPrefix(ctx.channel()), command);
if (traceEnabled) {
logger.trace("{} Sent: {}", logPrefix(ctx.channel()), out.toString(Charset.defaultCharset()).trim());
}
}
}
代码示例来源:origin: qunarcorp/qmq
out.markWriterIndex();
代码示例来源:origin: io.netty/netty-buffer
@Override
public final ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: io.netty/netty-buffer
@Override
public ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: apache/activemq-artemis
@Override
public ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
代码示例来源:origin: ProtocolSupport/ProtocolSupport
@Override
public final ByteBuf markWriterIndex() {
this.buf.markWriterIndex();
return this;
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
@Override
public final ByteBuf markWriterIndex() {
buf.markWriterIndex();
return this;
}
内容来源于网络,如有侵权,请联系作者删除!