diff options
Diffstat (limited to 'libjava/java/nio/ByteBufferImpl.java')
-rw-r--r-- | libjava/java/nio/ByteBufferImpl.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java index 7734dbf12cd..d9f24627de0 100644 --- a/libjava/java/nio/ByteBufferImpl.java +++ b/libjava/java/nio/ByteBufferImpl.java @@ -1,5 +1,5 @@ /* ByteBufferImpl.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -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; } @@ -178,7 +185,7 @@ final class ByteBufferImpl extends ByteBuffer } /** - * Absolute put method. Writes <code>value</value> to position + * Absolute put method. Writes <code>value</code> to position * <code>index</code> in the buffer. * * @exception IndexOutOfBoundsException If index is negative or not smaller |