diff options
Diffstat (limited to 'libjava/classpath/java/nio/DoubleBufferImpl.java')
-rw-r--r-- | libjava/classpath/java/nio/DoubleBufferImpl.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libjava/classpath/java/nio/DoubleBufferImpl.java b/libjava/classpath/java/nio/DoubleBufferImpl.java index 248ab45e7c2..98e8e974fff 100644 --- a/libjava/classpath/java/nio/DoubleBufferImpl.java +++ b/libjava/classpath/java/nio/DoubleBufferImpl.java @@ -82,15 +82,14 @@ final class DoubleBufferImpl extends DoubleBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } |