Commit c6cc541b by Michael Koch Committed by Michael Koch

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
parent ef874386
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> 2005-04-01 Tom Tromey <tromey@redhat.com>
* java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal): * java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal):
......
/* PipedInputStream.java -- Read portion of piped streams. /* 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. This file is part of GNU Classpath.
...@@ -226,18 +226,17 @@ public class PipedInputStream extends InputStream ...@@ -226,18 +226,17 @@ public class PipedInputStream extends InputStream
} }
/** /**
* This method reads bytes from the stream into a caller supplied buffer. * This method reads one byte from the stream.
* It starts storing bytes at position <code>offset</code> into the * -1 is returned to indicated that no bytes can be read
* 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
* because the end of the stream was reached. If the stream is already * 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. * 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 public int read() throws IOException
{ {
...@@ -248,7 +247,7 @@ public class PipedInputStream extends InputStream ...@@ -248,7 +247,7 @@ public class PipedInputStream extends InputStream
// if this method is never called. // if this method is never called.
int r = read(read_buf, 0, 1); int r = read(read_buf, 0, 1);
return r != -1 ? read_buf[0] : -1; return r != -1 ? (read_buf[0] & 0xff) : -1;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment