You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by rb...@apache.org on 2013/07/02 15:22:45 UTC
[3/4] git commit: the position of the ByteBuffer is only used in
slice, get(byte[]) and put(byte[])
the position of the ByteBuffer is only used in slice, get(byte[]) and put(byte[])
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/65da1702
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/65da1702
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/65da1702
Branch: refs/heads/trunk
Commit: 65da17020bb4a6e06b835ba04293f292ab8ed155
Parents: a393c26
Author: Raphaël P. Barazzutti <rb...@apache.org>
Authored: Tue Jul 2 09:34:25 2013 +0200
Committer: Raphaël P. Barazzutti <rb...@apache.org>
Committed: Tue Jul 2 09:34:25 2013 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/mina/codec/IoBuffer.java | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/65da1702/codec/src/main/java/org/apache/mina/codec/IoBuffer.java
----------------------------------------------------------------------
diff --git a/codec/src/main/java/org/apache/mina/codec/IoBuffer.java b/codec/src/main/java/org/apache/mina/codec/IoBuffer.java
index ec89b4a..de545c2 100644
--- a/codec/src/main/java/org/apache/mina/codec/IoBuffer.java
+++ b/codec/src/main/java/org/apache/mina/codec/IoBuffer.java
@@ -349,7 +349,7 @@ public final class IoBuffer {
if (remaining() < length) {
throw new BufferUnderflowException();
}
-
+ position.getNode().getBuffer().position(position.getPositionInNode());
int remainsToCopy = length;
int currentOffset = offset;
@@ -365,6 +365,7 @@ public final class IoBuffer {
position.setPosition(position.getPosition() + blocksize);
}
+ position.getNode().getBuffer().position(0);
return this;
}
@@ -660,7 +661,7 @@ public final class IoBuffer {
int remainsToCopy = length;
int currentOffset = offset;
-
+ position.getNode().getBuffer().position(position.getPositionInNode());
while (remainsToCopy > 0) {
position.updatePos();
@@ -673,6 +674,7 @@ public final class IoBuffer {
position.setPosition(position.getPosition() + blocksize);
}
+ position.getNode().getBuffer().position(0);
return this;
}
@@ -854,9 +856,6 @@ public final class IoBuffer {
private void setPosition(Pointer position) {
this.position = position;
- if (capacity > 0) {
- position.getNode().getBuffer().position(position.getPositionInNode());
- }
}
/**
@@ -866,7 +865,7 @@ public final class IoBuffer {
position.updatePos();
IoBuffer out = new IoBuffer();
out.order(order());
-
+ position.getNode().getBuffer().position(position.getPositionInNode());
if (hasRemaining()) {
tail.getBuffer().limit(limit.getPositionInNode());
for (BufferNode node = position.getNode(); node != limit.getNode(); node = node.getNext()) {
@@ -881,7 +880,7 @@ public final class IoBuffer {
out.add(tail.getBuffer().slice());
tail.getBuffer().limit(tail.getBuffer().capacity());
}
-
+ position.getNode().getBuffer().position(0);
return out;
}