本文整理了Java中io.netty.buffer.ByteBuf.resetReaderIndex()
方法的一些代码示例,展示了ByteBuf.resetReaderIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.resetReaderIndex()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:resetReaderIndex
[英]Repositions the current readerIndex to the marked readerIndex in this buffer.
[中]将当前readerIndex重新定位到此缓冲区中标记的readerIndex。
代码示例来源:origin: apache/incubator-dubbo
@Override
public void resetReaderIndex() {
buffer.resetReaderIndex();
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf resetReaderIndex() {
buffer.resetReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public final ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源:origin: netty/netty
@Override
public void reset() throws IOException {
buffer.resetReaderIndex();
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf resetReaderIndex() {
buffer.resetReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public final ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源:origin: redisson/redisson
@Override
public void reset() throws IOException {
buffer.resetReaderIndex();
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public final ByteBuf resetReaderIndex() {
buf.resetReaderIndex();
return this;
}
代码示例来源: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: 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
@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: neo4j/neo4j
private void logMessageOnError( ByteBuf byteBuf )
{
// move reader index back to the beginning of the message in order to log its full content
byteBuf.resetReaderIndex();
log.error( "Failed to read an inbound message:\n" + hexDump( byteBuf ) + '\n' );
}
}
代码示例来源: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: 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;
}
内容来源于网络,如有侵权,请联系作者删除!