Example usage for io.netty.buffer ByteBuf clear

List of usage examples for io.netty.buffer ByteBuf clear

Introduction

In this page you can find the example usage for io.netty.buffer ByteBuf clear.

Prototype

public abstract ByteBuf clear();

Source Link

Document

Sets the readerIndex and writerIndex of this buffer to 0 .

Usage

From source file:z.offheap.buffer.contrast.ContrastTestNettyByteBuf.java

License:Open Source License

private long doWithNettyByteBuf(ByteBuf bn, int i) {
    bn.clear().writeByte(i).writeByte(i).writeShort(i).writeInt(i).writeLong(i);

    long rnb1 = bn.readLong();
    long rnb2 = bn.readLong();

    return rnb1 + rnb2;
}