Fix a bug in AbstractByteBuf.writeZero() where the capacity is not auto-expanded

This commit is contained in:
Trustin Lee 2013-07-18 09:53:45 +09:00
parent fc7c950b08
commit f0a3f849f7

View File

@ -862,8 +862,7 @@ public abstract class AbstractByteBuf extends ByteBuf {
}
@Override
public int writeBytes(ScatteringByteChannel in, int length)
throws IOException {
public int writeBytes(ScatteringByteChannel in, int length) throws IOException {
ensureWritable(length);
int writtenBytes = setBytes(writerIndex, in, length);
if (writtenBytes > 0) {
@ -878,6 +877,7 @@ public abstract class AbstractByteBuf extends ByteBuf {
return this;
}
ensureWritable(length);
checkIndex(writerIndex, length);
int nLong = length >>> 3;