diff --git a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java index ca86eb3cd0..cca309890d 100644 --- a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java @@ -577,7 +577,7 @@ public class CompositeByteBuf extends AbstractByteBuf { /** * Returns the {@link ByteBuf} portion of this {@link CompositeByteBuf} that - * contains the specified {@code index}. This is an expert method! + * contains the specified {@code index}. This is an expert method! * *

* Please note that since a {@link CompositeByteBuf} is made up of @@ -585,13 +585,14 @@ public class CompositeByteBuf extends AbstractByteBuf { * Instead, it only returns a portion of the composite buffer where the * index is located *

+ * * * @param index The {@code index} to search for and include in the returned {@link ByteBuf} * @return The {@link ByteBuf} that contains the specified {@code index} * @throws IndexOutOfBoundsException when the specified {@code index} is * less than zero, or larger than {@code capacity()} */ - public ByteBuf getBufferFor(int index) throws IndexOutOfBoundsException { + public ByteBuf getBuffer(int index) throws IndexOutOfBoundsException { if (index < 0 || index >= capacity()) { throw new IndexOutOfBoundsException("Invalid index: " + index + " - Bytes needed: " + index + ", maximum is " diff --git a/buffer/src/test/java/io/netty/buffer/AbstractCompositeChannelBufferTest.java b/buffer/src/test/java/io/netty/buffer/AbstractCompositeChannelBufferTest.java index 86fa2a5009..e1229b57c4 100644 --- a/buffer/src/test/java/io/netty/buffer/AbstractCompositeChannelBufferTest.java +++ b/buffer/src/test/java/io/netty/buffer/AbstractCompositeChannelBufferTest.java @@ -99,14 +99,14 @@ public abstract class AbstractCompositeChannelBufferTest extends CompositeByteBuf buf = (CompositeByteBuf) Unpooled.wrappedBuffer(new byte[] { 1, 2, 3, 4, 5 }, new byte[] {4, 5, 6, 7, 8, 9, 26}); //Ensure that a random place will be fine - assertEquals(buf.getBufferFor(2).capacity(), 5); + assertEquals(buf.getBuffer(2).capacity(), 5); //Loop through each byte byte index = 0; while (index < buf.capacity()) { - ByteBuf _buf = buf.getBufferFor(index++); + ByteBuf _buf = buf.getBuffer(index++); assertNotNull(_buf); assertTrue(_buf.capacity() > 0); assertNotNull(_buf.getByte(0));