aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio/MappedByteBufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/nio/MappedByteBufferImpl.java')
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index 63e0225bc51..fdb64c5bb0f 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -117,6 +117,8 @@ final class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer compact()
{
+ checkIfReadOnly();
+ mark = -1;
int pos = position();
if (pos > 0)
{
@@ -126,6 +128,11 @@ final class MappedByteBufferImpl extends MappedByteBuffer
position(count);
limit(capacity());
}
+ else
+ {
+ position(limit());
+ limit(capacity());
+ }
return this;
}