diff options
| author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-24 15:43:22 +0000 |
|---|---|---|
| committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-24 15:43:22 +0000 |
| commit | 66a5af9f944650beba25b77f584add09b33e10ce (patch) | |
| tree | 750d1ed56fc294b0379fe7e0121d2ea862ae4dde /libjava/java/io/OutputStreamWriter.java | |
| parent | b8e27232744db1d2ad45d733d2499bd721a45637 (diff) | |
| download | gcc-66a5af9f944650beba25b77f584add09b33e10ce.tar.gz | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64806 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/OutputStreamWriter.java')
| -rw-r--r-- | libjava/java/io/OutputStreamWriter.java | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index a284542d44a..1d63d5650d1 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 + |
