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:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation
|
||||
/* Copyright (C) 1999, 2000, 2001, 2003, 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 UnicodeToBytes extends IOConverter
|
||||
{
|
||||
/** Buffer to emit bytes to.
|
||||
@@ -99,10 +101,22 @@ public abstract class UnicodeToBytes extends IOConverter
|
||||
catch (Throwable ex)
|
||||
{
|
||||
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 Output_iconv (encoding);
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
// Ignore, and try the next method.
|
||||
}
|
||||
try
|
||||
{
|
||||
// Try using finding java.nio.charset.Charset and using
|
||||
// the adaptor. Use the original name as Charsets have
|
||||
// their own canonical names.
|
||||
return new CharsetToBytesAdaptor(Charset.forName(encoding));
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user