aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/OutputStreamWriter.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-03-24 15:43:22 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-03-24 15:43:22 +0000
commit950ebbeaf050929030c0bb0b89c9d0aa870d973d (patch)
tree750d1ed56fc294b0379fe7e0121d2ea862ae4dde /libjava/java/io/OutputStreamWriter.java
parent6db450f90a63561e279076b6b143c035369265af (diff)
downloadgcc-950ebbeaf050929030c0bb0b89c9d0aa870d973d.zip
gcc-950ebbeaf050929030c0bb0b89c9d0aa870d973d.tar.gz
gcc-950ebbeaf050929030c0bb0b89c9d0aa870d973d.tar.bz2
2003-03-24 Michael Koch <konqueror@gmx.de>
* 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
Diffstat (limited to 'libjava/java/io/OutputStreamWriter.java')
-rw-r--r--libjava/java/io/OutputStreamWriter.java49
1 files changed, 41 insertions, 8 deletions
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 <code>OutputStreamWriter</code>
+ * to write to the specified stream using the default encoding.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ */
public OutputStreamWriter(OutputStream out)
{
this(out, UnicodeToBytes.getDefaultEncoder());
}
+ /**
+ * This method closes this stream, and the underlying
+ * <code>OutputStream</code>
+ *
+ * @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 <code>null</code>.
+ *
+ * @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
+