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/InputStreamReader.java | 39 +++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'libjava/java/io/InputStreamReader.java') diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java index 51ddf76f68c..70213b5f843 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 + * InputStream. + * + * @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 null. + * + * @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 true if is, or false 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 true if the stream is ready to be read, + * false 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 + -- cgit v1.2.3