Index: gnu/java/nio/charset/UTF_8.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/charset/UTF_8.java,v retrieving revision 1.6 diff -u -r1.6 UTF_8.java --- gnu/java/nio/charset/UTF_8.java 8 Apr 2005 21:46:06 -0000 1.6 +++ gnu/java/nio/charset/UTF_8.java 9 Apr 2005 03:14:38 -0000 @@ -95,7 +95,7 @@ // Package-private to avoid a trampoline constructor. Decoder (Charset cs) { - super (cs, 0.9f, 0.25f); + super (cs, 1f, 1f); } protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out) @@ -117,7 +117,7 @@ return CoderResult.OVERFLOW; out.put ((char) b1); inPos++; - break; + break; case 0xC: case 0xD: byte b2; Index: java/nio/charset/Charset.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/charset/Charset.java,v retrieving revision 1.15 diff -u -r1.15 Charset.java --- java/nio/charset/Charset.java 18 Feb 2005 01:35:46 -0000 1.15 +++ java/nio/charset/Charset.java 9 Apr 2005 03:14:40 -0000 @@ -296,8 +296,8 @@ cachedEncoder = newEncoder () .onMalformedInput (CodingErrorAction.REPLACE) .onUnmappableCharacter (CodingErrorAction.REPLACE); - } - + } else + cachedEncoder.reset(); return cachedEncoder.encode (cb); } } @@ -327,7 +327,8 @@ cachedDecoder = newDecoder () .onMalformedInput (CodingErrorAction.REPLACE) .onUnmappableCharacter (CodingErrorAction.REPLACE); - } + } else + cachedDecoder.reset(); return cachedDecoder.decode (bb); } Index: java/nio/charset/CharsetDecoder.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/charset/CharsetDecoder.java,v retrieving revision 1.5 diff -u -r1.5 CharsetDecoder.java --- java/nio/charset/CharsetDecoder.java 15 Jul 2004 13:21:10 -0000 1.5 +++ java/nio/charset/CharsetDecoder.java 9 Apr 2005 03:14:40 -0000 @@ -131,7 +131,11 @@ reset(); out.flip (); - return out; + + // Unfortunately, resizing the actual charbuffer array is required. + char[] resized = new char[out.remaining()]; + out.get(resized); + return CharBuffer.wrap(resized); } public final CoderResult decode (ByteBuffer in, CharBuffer out, @@ -156,7 +160,7 @@ cr = decodeLoop (in, out); } catch (RuntimeException e) - { + { throw new CoderMalfunctionError (e); } Index: java/nio/charset/CharsetEncoder.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/charset/CharsetEncoder.java,v retrieving revision 1.5 diff -u -r1.5 CharsetEncoder.java --- java/nio/charset/CharsetEncoder.java 3 Mar 2003 07:09:20 -0000 1.5 +++ java/nio/charset/CharsetEncoder.java 9 Apr 2005 03:14:40 -0000 @@ -183,7 +183,11 @@ cr.throwException (); out.flip (); - return out; + + // Unfortunately, resizing the actual bytebuffer array is required. + byte[] resized = new byte[out.remaining()]; + out.get(resized); + return ByteBuffer.wrap(resized); } public final CoderResult encode (CharBuffer in, ByteBuffer out,