[#1439] Fix CompositeByteBuf.nioBufferCount() to return the correct number

This commit is contained in:
Norman Maurer 2013-06-11 16:02:36 +02:00
parent c3034c8964
commit bf046492fb

View File

@ -976,7 +976,16 @@ public class DefaultCompositeByteBuf extends AbstractReferenceCountedByteBuf imp
@Override
public int nioBufferCount() {
return components.size();
if (components.size() == 1) {
return components.get(0).buf.nioBufferCount();
} else {
int count = 0;
for (int i = 0; i < components.size(); i++) {
Component c = components.get(i);
count+= c.buf.nioBufferCount();
}
return count;
}
}
@Override