summaryrefslogtreecommitdiff
path: root/java/nio/ByteBufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/nio/ByteBufferImpl.java')
-rw-r--r--java/nio/ByteBufferImpl.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/java/nio/ByteBufferImpl.java b/java/nio/ByteBufferImpl.java
index cbe627b06..aa51a65bd 100644
--- a/java/nio/ByteBufferImpl.java
+++ b/java/nio/ByteBufferImpl.java
@@ -115,12 +115,10 @@ final class ByteBufferImpl extends ByteBuffer
checkIfReadOnly();
mark = -1;
int pos = position();
- if (pos > 0)
- {
- int count = remaining();
- shiftDown(0, pos, count);
- position(count);
- }
+ int n = limit() - pos;
+ if (n > 0)
+ shiftDown(0, pos, n);
+ position(n);
limit(capacity());
return this;
}