Fixed a bug where AbstractChannelBuffer.writeBytes() decreases the writerIndex when the specified channel is closed.

This commit is contained in:
Trustin Lee 2008-09-06 09:11:18 +00:00
parent 33a4a9f8e1
commit e34d494496

View File

@ -427,7 +427,9 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public int writeBytes(ScatteringByteChannel in, int length)
throws IOException {
int writtenBytes = setBytes(writerIndex, in, length);
writerIndex += writtenBytes;
if (writtenBytes > 0) {
writerIndex += writtenBytes;
}
return writtenBytes;
}