本文整理了Java中io.netty.buffer.ByteBuf.markReaderIndex()
方法的一些代码示例,展示了ByteBuf.markReaderIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.markReaderIndex()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:markReaderIndex
[英]Marks the current readerIndex in this buffer. You can reposition the current readerIndex to the marked readerIndex by calling #resetReaderIndex(). The initial value of the marked readerIndex is 0.
[中]标记此缓冲区中的当前readerIndex。通过调用#resetReaderIndex(),可以将当前readerIndex重新定位到标记的readerIndex。标记的readerIndex的初始值为0。
代码示例来源:origin: apache/incubator-dubbo
@Override
public void markReaderIndex() {
buffer.markReaderIndex();
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf markReaderIndex() {
buf.markReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf markReaderIndex() {
buffer.markReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public final ByteBuf markReaderIndex() {
buf.markReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public void mark(int readlimit) {
buffer.markReaderIndex();
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf markReaderIndex() {
buf.markReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public final ByteBuf markReaderIndex() {
buf.markReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf markReaderIndex() {
buffer.markReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public void mark(int readlimit) {
buffer.markReaderIndex();
}
代码示例来源:origin: wildfly/wildfly
@Override
public final ByteBuf markReaderIndex() {
buf.markReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
static String decodeDomainName(ByteBuf in) {
in.markReaderIndex();
try {
return DefaultDnsRecordDecoder.decodeName(in);
} catch (CorruptedFrameException e) {
// In this case we just return null.
return null;
} finally {
in.resetReaderIndex();
}
}
代码示例来源:origin: netty/netty
startIndex = buffer.readerIndex();
endIndex = startIndex + length;
buffer.markReaderIndex();
代码示例来源:origin: apache/incubator-shardingsphere
@Override
protected void doDecode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
int messageTyepLength = 0;
if ('\0' == in.markReaderIndex().readByte()) {
in.resetReaderIndex();
} else {
messageTyepLength = PostgreSQLPacket.MESSAGE_TYPE_LENGTH;
}
int payloadLength = in.readInt();
int realPacketLength = payloadLength + messageTyepLength;
if (readableBytes < realPacketLength) {
in.resetReaderIndex();
return;
}
in.resetReaderIndex();
out.add(in.readRetainedSlice(payloadLength + messageTyepLength));
}
代码示例来源:origin: wildfly/wildfly
static String decodeDomainName(ByteBuf in) {
in.markReaderIndex();
try {
return DefaultDnsRecordDecoder.decodeName(in);
} catch (CorruptedFrameException e) {
// In this case we just return null.
return null;
} finally {
in.resetReaderIndex();
}
}
代码示例来源:origin: apache/incubator-shardingsphere
@Override
protected void doDecode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
int payloadLength = in.markReaderIndex().readMediumLE();
int realPacketLength = payloadLength + MySQLPacket.PAYLOAD_LENGTH + MySQLPacket.SEQUENCE_LENGTH;
if (readableBytes < realPacketLength) {
in.resetReaderIndex();
return;
}
out.add(in.readRetainedSlice(payloadLength + MySQLPacket.SEQUENCE_LENGTH));
}
代码示例来源:origin: apache/incubator-shardingsphere
@Override
protected void doDecode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
int payloadLength = in.markReaderIndex().readMediumLE();
int realPacketLength = payloadLength + MySQLPacket.PAYLOAD_LENGTH + MySQLPacket.SEQUENCE_LENGTH;
if (readableBytes < realPacketLength) {
in.resetReaderIndex();
return;
}
out.add(in.readRetainedSlice(payloadLength + MySQLPacket.SEQUENCE_LENGTH));
}
代码示例来源:origin: netty/netty
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
throws Exception {
in.markReaderIndex();
int preIndex = in.readerIndex();
int length = readRawVarint32(in);
if (preIndex == in.readerIndex()) {
return;
}
if (length < 0) {
throw new CorruptedFrameException("negative length: " + length);
}
if (in.readableBytes() < length) {
in.resetReaderIndex();
} else {
out.add(in.readRetainedSlice(length));
}
}
代码示例来源:origin: redisson/redisson
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
throws Exception {
in.markReaderIndex();
int preIndex = in.readerIndex();
int length = readRawVarint32(in);
if (preIndex == in.readerIndex()) {
return;
}
if (length < 0) {
throw new CorruptedFrameException("negative length: " + length);
}
if (in.readableBytes() < length) {
in.resetReaderIndex();
} else {
out.add(in.readRetainedSlice(length));
}
}
代码示例来源:origin: apache/incubator-shardingsphere
@Override
protected int getHeader(final ByteBuf byteBuf) {
MySQLPacketPayload payload = new MySQLPacketPayload(byteBuf);
payload.getByteBuf().markReaderIndex();
payload.readInt1();
int result = payload.readInt1();
payload.getByteBuf().resetReaderIndex();
return result;
}
代码示例来源:origin: apache/incubator-shardingsphere
@Override
protected int getHeader(final ByteBuf byteBuf) {
MySQLPacketPayload payload = new MySQLPacketPayload(byteBuf);
payload.getByteBuf().markReaderIndex();
payload.readInt1();
int result = payload.readInt1();
payload.getByteBuf().resetReaderIndex();
return result;
}
内容来源于网络,如有侵权,请联系作者删除!