aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/convert/BytesToUnicode.java
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2006-01-03 22:58:31 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-01-03 22:58:31 +0000
commit8ceb88d4cd6ba729b38dee3bda925ab34a75efc9 (patch)
tree82dbb00c69057da2d374d746d77eb40854b23164 /libjava/gnu/gcj/convert/BytesToUnicode.java
parent368872c3154af66d44a984737b0119d88431c64f (diff)
downloadgcc-8ceb88d4cd6ba729b38dee3bda925ab34a75efc9.zip
gcc-8ceb88d4cd6ba729b38dee3bda925ab34a75efc9.tar.gz
gcc-8ceb88d4cd6ba729b38dee3bda925ab34a75efc9.tar.bz2
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
Diffstat (limited to 'libjava/gnu/gcj/convert/BytesToUnicode.java')
-rw-r--r--libjava/gnu/gcj/convert/BytesToUnicode.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/libjava/gnu/gcj/convert/BytesToUnicode.java b/libjava/gnu/gcj/convert/BytesToUnicode.java
index f33720a..e3afe3e 100644
--- a/libjava/gnu/gcj/convert/BytesToUnicode.java
+++ b/libjava/gnu/gcj/convert/BytesToUnicode.java
@@ -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,11 +106,20 @@ 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
+ " (" + ex + ')');
}