diff options
author | Michael Koch <konqueror@gmx.de> | 2003-03-24 15:43:22 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-03-24 15:43:22 +0000 |
commit | 950ebbeaf050929030c0bb0b89c9d0aa870d973d (patch) | |
tree | 750d1ed56fc294b0379fe7e0121d2ea862ae4dde /libjava/java/io/InputStreamReader.java | |
parent | 6db450f90a63561e279076b6b143c035369265af (diff) | |
download | gcc-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/InputStreamReader.java')
-rw-r--r-- | libjava/java/io/InputStreamReader.java | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java index 51ddf76..70213b5 100644 --- a/libjava/java/io/InputStreamReader.java +++ b/libjava/java/io/InputStreamReader.java @@ -66,10 +66,10 @@ public class InputStreamReader extends Reader this(in, BytesToUnicode.getDefaultDecoder()); } - public InputStreamReader(InputStream in, String enc) + public InputStreamReader(InputStream in, String encoding_name) throws UnsupportedEncodingException { - this(in, BytesToUnicode.getDecoder(enc)); + this(in, BytesToUnicode.getDecoder(encoding_name)); } private InputStreamReader(InputStream in, BytesToUnicode decoder) @@ -88,6 +88,12 @@ public class InputStreamReader extends Reader converter.setInput(this.in.buf, 0, 0); } + /** + * This method closes this stream, as well as the underlying + * <code>InputStream</code>. + * + * @exception IOException If an error occurs + */ public void close() throws IOException { synchronized (lock) @@ -100,11 +106,29 @@ public class InputStreamReader extends Reader } } + /** + * This method returns the name of the encoding that is currently in use + * by this object. If the stream has been closed, this method is allowed + * to return <code>null</code>. + * + * @param The current encoding name + */ public String getEncoding() { return in != null ? converter.getName() : null; } + /** + * This method checks to see if the stream is read to be read. It + * will return <code>true</code> if is, or <code>false</code> if it is not. + * If the stream is not ready to be read, it could (although is not required + * to) block on the next read attempt. + * + * @return <code>true</code> if the stream is ready to be read, + * <code>false</code> otherwise + * + * @exception IOException If an error occurs + */ public boolean ready() throws IOException { synchronized (lock) @@ -149,6 +173,13 @@ public class InputStreamReader extends Reader } } + /** + * This method reads a single character of data from the stream. + * + * @return The char read, as an int, or -1 if end of stream. + * + * @exception IOException If an error occurs + */ public int read() throws IOException { synchronized (lock) @@ -198,4 +229,6 @@ public class InputStreamReader extends Reader } } } -} + +} // class InputStreamReader + |