From 6f30a4a748afced35b10f7d42290977a6eb56df2 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Sun, 10 Aug 2008 15:16:02 +0000 Subject: [PATCH] Fixed a bug where Channel.getBytes and setBytes don't update the argument's reader/writerIndex when relative indexing is used. --- src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java index 468e5a7b87..e4a7f85268 100644 --- a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java @@ -153,6 +153,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, ChannelBuffer dst, int length) { getBytes(index, dst, dst.writerIndex(), length); + dst.writerIndex(dst.writerIndex() + length); } 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) { setBytes(index, src, src.readerIndex(), length); + src.readerIndex(src.readerIndex() + length); } public void setZero(int index, int length) {