diff options
author | David Daney <ddaney@avtrex.com> | 2006-01-03 22:58:31 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-01-03 22:58:31 +0000 |
commit | 8ceb88d4cd6ba729b38dee3bda925ab34a75efc9 (patch) | |
tree | 82dbb00c69057da2d374d746d77eb40854b23164 /libjava/java/io/OutputStreamWriter.java | |
parent | 368872c3154af66d44a984737b0119d88431c64f (diff) | |
download | gcc-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/java/io/OutputStreamWriter.java')
-rw-r--r-- | libjava/java/io/OutputStreamWriter.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index 8b7beeb..90ecd9f 100644 --- a/libjava/java/io/OutputStreamWriter.java +++ b/libjava/java/io/OutputStreamWriter.java @@ -39,6 +39,9 @@ exception statement from your version. */ package java.io; import gnu.gcj.convert.UnicodeToBytes; +import gnu.gcj.convert.CharsetToBytesAdaptor; +import java.nio.charset.Charset; +import java.nio.charset.CharsetEncoder; /** * This class writes characters to an output stream that is byte oriented @@ -129,6 +132,31 @@ public class OutputStreamWriter extends Writer } /** + * This method initializes a new instance of <code>OutputStreamWriter</code> + * to write to the specified stream using a given <code>Charset</code>. + * + * @param out The <code>OutputStream</code> to write to + * @param cs The <code>Charset</code> of the encoding to use + */ + public OutputStreamWriter(OutputStream out, Charset cs) + { + this(out, new CharsetToBytesAdaptor(cs)); + } + + /** + * This method initializes a new instance of <code>OutputStreamWriter</code> + * to write to the specified stream using a given + * <code>CharsetEncoder</code>. + * + * @param out The <code>OutputStream</code> to write to + * @param enc The <code>CharsetEncoder</code> to encode the output with + */ + public OutputStreamWriter(OutputStream out, CharsetEncoder enc) + { + this(out, new CharsetToBytesAdaptor(enc)); + } + + /** * This method closes this stream, and the underlying * <code>OutputStream</code> * |