Allow to access memoryAddress of wrapped ByteBuf for ReadOnlyByteBuf

Motivation:

We should allow to access the memoryAddress of the wrapped ByteBuf when using ReadOnlyByteBuf for peformance reasons. If a user act on a memoryAddress its his responsible anyway to do nothing "stupid".

Modifications:

Delegate to wrapped ByteBuf.

Result:

Less performance overhead for various operations and also when writing to a native transport (which needs the memoryAddress).
This commit is contained in:
Norman Maurer 2017-06-07 10:33:54 +02:00
parent 629b83e0a5
commit 7922757575

View File

@ -103,12 +103,12 @@ public class ReadOnlyByteBuf extends AbstractDerivedByteBuf {
@Override
public boolean hasMemoryAddress() {
return false;
return unwrap().hasMemoryAddress();
}
@Override
public long memoryAddress() {
throw new ReadOnlyBufferException();
return unwrap().memoryAddress();
}
@Override