Let CompositeByteBuf implement Iterable
Motivation: CompositeByteBuf has an iterator() method but fails to implement Iterable Modifications: Let CompositeByteBuf implement Iterable<ByteBuf> Result: Easier usage
This commit is contained in:
parent
aa1e537de4
commit
18627749a9
@ -37,7 +37,7 @@ import java.util.ListIterator;
|
|||||||
* {@link ByteBufAllocator#compositeBuffer()} or {@link Unpooled#wrappedBuffer(ByteBuf...)} instead of calling the
|
* {@link ByteBufAllocator#compositeBuffer()} or {@link Unpooled#wrappedBuffer(ByteBuf...)} instead of calling the
|
||||||
* constructor explicitly.
|
* constructor explicitly.
|
||||||
*/
|
*/
|
||||||
public class CompositeByteBuf extends AbstractReferenceCountedByteBuf {
|
public class CompositeByteBuf extends AbstractReferenceCountedByteBuf implements Iterable<ByteBuf> {
|
||||||
|
|
||||||
private static final ByteBuffer EMPTY_NIO_BUFFER = Unpooled.EMPTY_BUFFER.nioBuffer();
|
private static final ByteBuffer EMPTY_NIO_BUFFER = Unpooled.EMPTY_BUFFER.nioBuffer();
|
||||||
|
|
||||||
@ -371,6 +371,7 @@ public class CompositeByteBuf extends AbstractReferenceCountedByteBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator<ByteBuf> iterator() {
|
public Iterator<ByteBuf> iterator() {
|
||||||
ensureAccessible();
|
ensureAccessible();
|
||||||
List<ByteBuf> list = new ArrayList<ByteBuf>(components.size());
|
List<ByteBuf> list = new ArrayList<ByteBuf>(components.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user