summaryrefslogtreecommitdiffstats
path: root/libjava/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-21 21:41:32 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-21 21:41:32 +0000
commitcfdfcebbe92b95507531f6619f6d16334ac31943 (patch)
tree68700a10d2ec54f555f52f3d62ae77bc56a2da46 /libjava/java
parent15285b1920899dc866d9e0116687473ff236c7b5 (diff)
downloadppe42-gcc-cfdfcebbe92b95507531f6619f6d16334ac31943.tar.gz
ppe42-gcc-cfdfcebbe92b95507531f6619f6d16334ac31943.zip
* java/io/PipedInputStream.java, java/io/PipedOutputStream.java:
Yet another new version from Classpath. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33328 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/io/PipedInputStream.java31
-rw-r--r--libjava/java/io/PipedOutputStream.java9
2 files changed, 13 insertions, 27 deletions
diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java
index 97c034bd11b..e25f163f604 100644
--- a/libjava/java/io/PipedInputStream.java
+++ b/libjava/java/io/PipedInputStream.java
@@ -398,30 +398,19 @@ read(byte[] buf, int offset, int len) throws IOException
* If there is no data ready to be written, or if the internal circular
* buffer is full, this method blocks.
*
- * *****What is this method really supposed to do *********
+ * @param byte_received The byte to write to this stream
+ *
+ * @exception IOException if error occurs
+ *
*/
protected synchronized void
receive(int byte_received) throws IOException
{
- int orig_in = in;
-
- for (;;)
- {
- // Wait for something to happen
- try
- {
- wait();
- }
- catch(InterruptedException e) { ; }
-
- // See if we woke up because the stream was closed on us
- if (closed)
- throw new IOException("Stream closed before receiving byte");
-
- // See if a byte of data was received
- if (in != orig_in)
- return;
- }
+ // This is really slow, but it has the benefit of not duplicating
+ // the complicated machinery in receive(byte[],int,int).
+ byte[] buf = new byte[1];
+ buf[0] = (byte) (byte_received & 0xff);
+ receive (buf, 0, 1);
}
/*************************************************************************/
@@ -439,7 +428,7 @@ receive(int byte_received) throws IOException
* @exception IOException If an error occurs
*/
synchronized void
-write(byte[] buf, int offset, int len) throws IOException
+receive(byte[] buf, int offset, int len) throws IOException
{
if (len <= 0)
return;
diff --git a/libjava/java/io/PipedOutputStream.java b/libjava/java/io/PipedOutputStream.java
index 6d1061230be..b12d1e5f55e 100644
--- a/libjava/java/io/PipedOutputStream.java
+++ b/libjava/java/io/PipedOutputStream.java
@@ -1,5 +1,5 @@
/* PipedOutputStream.java -- Write portion of piped streams.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -164,10 +164,7 @@ close() throws IOException
public synchronized void
write(int b) throws IOException
{
- byte[] buf = new byte[1];
- buf[0] = (byte)(b & 0xFF);
-
- snk.write(buf, 0, buf.length);
+ snk.receive (b);
}
/*************************************************************************/
@@ -188,7 +185,7 @@ write(int b) throws IOException
public void
write(byte[] buf, int offset, int len) throws IOException
{
- snk.write(buf, 0, len);
+ snk.receive (buf, 0, len);
}
/*************************************************************************/
OpenPOWER on IntegriCloud