diff options
Diffstat (limited to 'libjava/java/nio/ByteBufferImpl.java')
-rw-r--r-- | libjava/java/nio/ByteBufferImpl.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java index b1e6b1f..d9f2462 100644 --- a/libjava/java/nio/ByteBufferImpl.java +++ b/libjava/java/nio/ByteBufferImpl.java @@ -112,6 +112,8 @@ final class ByteBufferImpl extends ByteBuffer public ByteBuffer compact () { + checkIfReadOnly(); + mark = -1; int pos = position(); if (pos > 0) { @@ -120,6 +122,11 @@ final class ByteBufferImpl extends ByteBuffer position(count); limit(capacity()); } + else + { + position(limit()); + limit(capacity()); + } return this; } |