aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2005-04-01 20:04:21 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2005-04-01 20:04:21 +0000
commitc6cc541b36aaf32335a6e4b420b55bf7c9a979be (patch)
tree63a04daa2c80c5e824b3c2addaeb8a198f30b260 /libjava
parentef87438639663154314e2cc5cd692eddaebfc799 (diff)
downloadgcc-c6cc541b36aaf32335a6e4b420b55bf7c9a979be.zip
gcc-c6cc541b36aaf32335a6e4b420b55bf7c9a979be.tar.gz
gcc-c6cc541b36aaf32335a6e4b420b55bf7c9a979be.tar.bz2
2005-04-01 Michael Koch <konqueror@gmx.de>
* java/io/PipedInputStream.java (read): Make sure a positive byte value is returned. Revised javadoc. Thanks to Olafur Bragason for reporting these bugs. From-SVN: r97416
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/io/PipedInputStream.java23
2 files changed, 17 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 0b53eaa..3a928e51 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-01 Michael Koch <konqueror@gmx.de>
+
+ * java/io/PipedInputStream.java
+ (read): Make sure a positive byte value is returned. Revised javadoc.
+ Thanks to Olafur Bragason for reporting these bugs.
+
2005-04-01 Tom Tromey <tromey@redhat.com>
* java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal):
diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java
index 906ef10..d424587 100644
--- a/libjava/java/io/PipedInputStream.java
+++ b/libjava/java/io/PipedInputStream.java
@@ -1,5 +1,5 @@
/* PipedInputStream.java -- Read portion of piped streams.
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -226,18 +226,17 @@ public class PipedInputStream extends InputStream
}
/**
- * This method reads bytes from the stream into a caller supplied buffer.
- * It starts storing bytes at position <code>offset</code> into the
- * buffer and
- * reads a maximum of <code>len</code> bytes. Note that this method
- * can actually
- * read fewer than <code>len</code> bytes. The actual number of bytes
- * read is
- * returned. A -1 is returned to indicated that no bytes can be read
+ * This method reads one byte from the stream.
+ * -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached. If the stream is already
* closed, a -1 will again be returned to indicate the end of the stream.
- * <p>
- * This method will block if no byte is available to be read.
+ *
+ * <p>This method will block if no byte is available to be read.</p>
+ *
+ * @return the value of the read byte value, or -1 of the end of the stream
+ * was reached
+ *
+ * @throws IOException if an error occured
*/
public int read() throws IOException
{
@@ -248,7 +247,7 @@ public class PipedInputStream extends InputStream
// if this method is never called.
int r = read(read_buf, 0, 1);
- return r != -1 ? read_buf[0] : -1;
+ return r != -1 ? (read_buf[0] & 0xff) : -1;
}
/**