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:
parent
368872c315
commit
8ceb88d4cd
12 changed files with 420 additions and 186 deletions
|
@ -39,6 +39,8 @@ exception statement from your version. */
|
|||
package java.io;
|
||||
|
||||
import gnu.gcj.convert.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
|
||||
/**
|
||||
* This class reads characters from a byte input stream. The characters
|
||||
|
@ -131,6 +133,25 @@ public class InputStreamReader extends Reader
|
|||
this(in, BytesToUnicode.getDecoder(encoding_name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an InputStreamReader that uses a decoder of the given
|
||||
* charset to decode the bytes in the InputStream into
|
||||
* characters.
|
||||
*/
|
||||
public InputStreamReader(InputStream in, Charset charset)
|
||||
{
|
||||
this(in, new BytesToCharsetAdaptor(charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an InputStreamReader that uses the given charset decoder
|
||||
* to decode the bytes in the InputStream into characters.
|
||||
*/
|
||||
public InputStreamReader(InputStream in, CharsetDecoder decoder)
|
||||
{
|
||||
this(in, new BytesToCharsetAdaptor(decoder));
|
||||
}
|
||||
|
||||
private InputStreamReader(InputStream in, BytesToUnicode decoder)
|
||||
{
|
||||
// FIXME: someone could pass in a BufferedInputStream whose buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue