Index: java/nio/ByteBufferImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/ByteBufferImpl.java,v retrieving revision 1.10 diff -u -r1.10 ByteBufferImpl.java --- java/nio/ByteBufferImpl.java 16 Feb 2005 12:36:21 -0000 1.10 +++ java/nio/ByteBufferImpl.java 18 Apr 2005 08:38:02 -0000 @@ -144,11 +144,10 @@ */ public byte get () { - checkForUnderflow(); + if (pos >= limit) + throw new BufferUnderflowException(); - byte result = backing_buffer [position () + array_offset]; - position (position () + 1); - return result; + return backing_buffer [(pos++) + array_offset]; } /** @@ -161,12 +160,12 @@ */ public ByteBuffer put (byte value) { - checkIfReadOnly(); - checkForOverflow(); + if (readOnly) + throw new ReadOnlyBufferException(); + if (pos >= limit) + throw new BufferOverflowException(); - int pos = position(); - backing_buffer [pos + array_offset] = value; - position (pos + 1); + backing_buffer [(pos++) + array_offset] = value; return this; } Index: java/nio/CharBufferImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/CharBufferImpl.java,v retrieving revision 1.7 diff -u -r1.7 CharBufferImpl.java --- java/nio/CharBufferImpl.java 30 Dec 2004 10:20:11 -0000 1.7 +++ java/nio/CharBufferImpl.java 18 Apr 2005 08:38:03 -0000 @@ -62,6 +62,7 @@ { super (copy.capacity (), copy.limit (), copy.position (), 0); backing_buffer = copy.backing_buffer; + array_offset = copy.array_offset; readOnly = copy.isReadOnly (); } @@ -127,11 +128,10 @@ */ public char get () { - checkForUnderflow(); + if (pos >= limit) + throw new BufferUnderflowException(); - char result = backing_buffer [position ()]; - position (position () + 1); - return result; + return backing_buffer [(pos++) + array_offset]; } /** @@ -142,10 +142,12 @@ */ public CharBuffer put (char value) { - checkIfReadOnly(); - - backing_buffer [position ()] = value; - position (position () + 1); + if (readOnly) + throw new ReadOnlyBufferException(); + if (pos >= limit) + throw new BufferOverflowException(); + + backing_buffer [(pos++) + array_offset] = value; return this; } @@ -162,7 +164,7 @@ { checkIndex(index); - return backing_buffer [index]; + return backing_buffer [index + array_offset]; } /** @@ -178,7 +180,7 @@ checkIndex(index); checkIfReadOnly(); - backing_buffer [index] = value; + backing_buffer [index + array_offset] = value; return this; }