PR libgcj/9715, PR libgcj/19132:

* java/nio/charset/Charset.java (charsetForName): Try default
	provider first.
	(availableCharsets): Re-merged.
	(providers2): Likewise.
	(defaultCharset): Likewise.
	* sources.am, Makefile.in: Rebuilt.
	* gnu/java/nio/charset/Provider.java: Removed.
	* java/io/OutputStreamWriter.java
	(OutputStreamWriter(OutputStream,Charset)): New constructor.
	(OutputStreamWriter(OutputStream,CharsetEncoder)): Likewise.
	* java/io/InputStreamReader.java
	(InputStreamReader(InputStream,CharsetDecoder)): New constructor.
	(InputStreamReader(InputStream,Charset)): Likewise.
	* gnu/gcj/convert/BytesToUnicode.java (getDecoder): Try a
	BytesToCharsetAdaptor.
	* gnu/gcj/convert/UnicodeToBytes.java (getEncoder): Try a
	CharsetToBytesAdaptor.
	* gnu/gcj/convert/CharsetToBytesAdaptor.java: New file.
	* gnu/gcj/convert/BytesToCharsetAdaptor.java: New file.
	* mauve-libgcj: Remove getEncoding exclusion.

Co-Authored-By: Tom Tromey <tromey@redhat.com>

From-SVN: r109294
This commit is contained in:
David Daney
2006-01-03 22:58:31 +00:00
committed by Tom Tromey
parent 368872c315
commit 8ceb88d4cd
12 changed files with 420 additions and 186 deletions
+13 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation
This file is part of libgcj.
@@ -8,6 +8,8 @@ details. */
package gnu.gcj.convert;
import java.nio.charset.Charset;
public abstract class BytesToUnicode extends IOConverter
{
/** Buffer to read bytes from.
@@ -104,9 +106,18 @@ public abstract class BytesToUnicode extends IOConverter
try
{
// We pass the original name to iconv and let it handle
// its own aliasing.
// its own aliasing. Note that we intentionally prefer
// iconv over nio.
return new Input_iconv (encoding);
}
catch (Throwable _)
{
// Ignore, and try the next method.
}
try
{
return new BytesToCharsetAdaptor(Charset.forName(encoding));
}
catch (Throwable _)
{
throw new java.io.UnsupportedEncodingException(encoding