This class is a character output stream
that uses a byte output stream as the destination for its data. When
characters are written to an
OutputStreamWriter, it translates
them into bytes according to a particular
locale- and/or platform-specific
character encoding and writes those bytes to the specified
OutputStream. This is a very important
internationalization feature in Java 1.1 and later.
OutputStreamWriter supports the usual
Writer methods. It also has a
getEncoding( ) method that returns the name of the
encoding being used to convert characters to bytes.
When you create an OutputStreamWriter, specify the
OutputStream to which it writes bytes and,
optionally, the name of the character encoding that should be used to
convert characters to bytes. If you do not specify an encoding name,
the OutputStreamWriter uses the default encoding
of the default locale, which is usually the correct thing to do. In
Java 1.4 and later, this class uses the
charset
conversion facilities of the java.nio.charset
package and allows you to explicitly specify the
Charset or CharsetEncoder to be
used. Prior to Java 1.4, the class allows you to specify only the
name of the desired charset encoding.
public class OutputStreamWriter extends Writer {
// Public Constructors
public OutputStreamWriter(OutputStream out);
public OutputStreamWriter(OutputStream out, String charsetName) throws
UnsupportedEncodingException;
1.4 public OutputStreamWriter(OutputStream out, java.nio.charset.CharsetEncoder enc);
1.4 public OutputStreamWriter(OutputStream out, java.nio.charset.Charset cs);
// Public Instance Methods
public String getEncoding( );
// Public Methods Overriding Writer
public void close( ) throws IOException;
public void flush( ) throws IOException;
public void write(int c) throws IOException;
public void write(char[ ] cbuf, int off, int len) throws IOException;
public void write(String str, int off, int len) throws IOException;
}