Simplify the process of getting the component
This commit is contained in:
parent
343d674839
commit
0d8ed47c3e
@ -582,15 +582,11 @@ public class CompositeByteBuf extends AbstractByteBuf {
|
||||
+ capacity());
|
||||
}
|
||||
|
||||
List<ByteBuf> components = decompose(index, 1);
|
||||
switch (components.size()) {
|
||||
case 0:
|
||||
return Unpooled.EMPTY_BUFFER;
|
||||
case 1:
|
||||
return components.get(0);
|
||||
default:
|
||||
throw new IOException("Index " + index + " is part of " + components.size() + " buffers!");
|
||||
}
|
||||
int componentId = componentId(index);
|
||||
|
||||
//Return the component byte buffer
|
||||
return components[componentId].duplicate();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user