Optimize derived buffers' forEachByte(...) implementation

- Related: #1378
This commit is contained in:
Trustin Lee 2013-06-27 17:36:22 +09:00
parent b5bb36c087
commit 98531313de
3 changed files with 15 additions and 0 deletions

View File

@ -291,5 +291,10 @@ public class DuplicatedByteBuf extends AbstractDerivedByteBuf {
public ByteBuffer internalNioBuffer(int index, int length) {
return buffer.internalNioBuffer(index, length);
}
@Override
public int forEachByte(int fromIndex, int toIndex, ByteBufProcessor processor) {
return buffer.forEachByte(fromIndex, toIndex, processor);
}
}

View File

@ -295,6 +295,11 @@ public class ReadOnlyByteBuf extends AbstractDerivedByteBuf {
return buffer.internalNioBuffer(index, length);
}
@Override
public int forEachByte(int fromIndex, int toIndex, ByteBufProcessor processor) {
return buffer.forEachByte(fromIndex, toIndex, processor);
}
@Override
public int capacity() {
return buffer.capacity();

View File

@ -273,4 +273,9 @@ public class SlicedByteBuf extends AbstractDerivedByteBuf {
checkIndex(index, length);
return buffer.internalNioBuffer(index + adjustment, length);
}
@Override
public int forEachByte(int fromIndex, int toIndex, ByteBufProcessor processor) {
return buffer.forEachByte(fromIndex + adjustment, toIndex + adjustment, processor);
}
}