Fixed a bug where Channel.getBytes and setBytes don't update the argument's reader/writerIndex when relative indexing is used.

This commit is contained in:
Trustin Lee 2008-08-10 15:16:02 +00:00
parent a1c07e9122
commit 6f30a4a748

View File

@ -153,6 +153,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public void getBytes(int index, ChannelBuffer dst, int length) { public void getBytes(int index, ChannelBuffer dst, int length) {
getBytes(index, dst, dst.writerIndex(), length); getBytes(index, dst, dst.writerIndex(), length);
dst.writerIndex(dst.writerIndex() + length);
} }
public void setBytes(int index, byte[] src) { public void setBytes(int index, byte[] src) {
@ -165,6 +166,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
public void setBytes(int index, ChannelBuffer src, int length) { public void setBytes(int index, ChannelBuffer src, int length) {
setBytes(index, src, src.readerIndex(), length); setBytes(index, src, src.readerIndex(), length);
src.readerIndex(src.readerIndex() + length);
} }
public void setZero(int index, int length) { public void setZero(int index, int length) {