From 950ebbeaf050929030c0bb0b89c9d0aa870d973d Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Mon, 24 Mar 2003 15:43:22 +0000 Subject: 2003-03-24 Michael Koch * java/io/DataOutputStream.java (write): Merged from classpath. * java/io/File.java: Merged copyrigth with classpath. * java/io/FileInputStream.java (getChannel): Made it synchronized instead of using a synchronized block. * java/io/FileOutputStream.java: Reformatted. * java/io/InputStreamReader.java (InputStreamReader): Renamed enc to encoding_name. (close): Merged documentation from classpath. (getEncoding): Merged documentation from classpath. (ready): Merged documentation from classpath. (read): Merged documentation from classpath. * java/io/LineNumberReader.java (lineNumber): Made it private. (LineNumberReader): Use Constant instead of a direct value. * java/io/OutputStreamWriter.java (OutputStreamWriter): Renamed enc to encoding_scheme, merged documentation from classpath. (close): Merged documentation from classpath. (flush): Merged documentation from classpath. (write): Merged documentation from classpath. * java/io/PrintStream.java: Reformatted. From-SVN: r64806 --- libjava/java/io/OutputStreamWriter.java | 49 +++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'libjava/java/io/OutputStreamWriter.java') diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index a284542..1d63d56 100644 --- a/libjava/java/io/OutputStreamWriter.java +++ b/libjava/java/io/OutputStreamWriter.java @@ -57,11 +57,6 @@ public class OutputStreamWriter extends Writer private char[] work; private int wcount; - public String getEncoding() - { - return out != null ? converter.getName() : null; - } - private OutputStreamWriter(OutputStream out, UnicodeToBytes encoder) { this.out = out instanceof BufferedOutputStream @@ -72,17 +67,29 @@ public class OutputStreamWriter extends Writer this.converter = encoder; } - public OutputStreamWriter(OutputStream out, String enc) + public OutputStreamWriter(OutputStream out, String encoding_scheme) throws UnsupportedEncodingException { - this(out, UnicodeToBytes.getEncoder(enc)); + this(out, UnicodeToBytes.getEncoder(encoding_scheme)); } + /** + * This method initializes a new instance of OutputStreamWriter + * to write to the specified stream using the default encoding. + * + * @param out The OutputStream to write to + */ public OutputStreamWriter(OutputStream out) { this(out, UnicodeToBytes.getDefaultEncoder()); } + /** + * This method closes this stream, and the underlying + * OutputStream + * + * @exception IOException If an error occurs + */ public void close() throws IOException { synchronized (lock) @@ -97,6 +104,23 @@ public class OutputStreamWriter extends Writer } } + /** + * This method returns the name of the character encoding scheme currently + * in use by this stream. If the stream has been closed, then this method + * may return null. + * + * @return The encoding scheme name + */ + public String getEncoding() + { + return out != null ? converter.getName() : null; + } + + /** + * This method flushes any buffered bytes to the underlying output sink. + * + * @exception IOException If an error occurs + */ public void flush() throws IOException { synchronized (lock) @@ -186,6 +210,13 @@ public class OutputStreamWriter extends Writer } } + /** + * This method writes a single character to the output stream. + * + * @param c The char to write, passed as an int. + * + * @exception IOException If an error occurs + */ public void write(int ch) throws IOException { synchronized (lock) @@ -203,4 +234,6 @@ public class OutputStreamWriter extends Writer work[wcount++] = (char) ch; } } -} + +} // class OutputStreamWriter + -- cgit v1.1