summaryrefslogtreecommitdiff
path: root/java/io/PipedInputStream.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2000-04-21 22:27:29 +0000
committerTom Tromey <tromey@redhat.com>2000-04-21 22:27:29 +0000
commit404dad7de21ba898f7403dbf9a245e2ac13182c2 (patch)
tree8c88f3f9696bfb7e2c783c50048538f29d2d6449 /java/io/PipedInputStream.java
parent831abd00fc73cbc74f86d8cfe299207aeb65b58d (diff)
downloadclasspath-404dad7de21ba898f7403dbf9a245e2ac13182c2.tar.gz
* PipedOutputStream.java (write(int)): Use `receive', not
`write'. (write(byte[],int,int): Likewise. * PipedInputStream.java (receive(byte[],int,int)): Renamed from `write'. (receive(int)): Rewrote.
Diffstat (limited to 'java/io/PipedInputStream.java')
-rw-r--r--java/io/PipedInputStream.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/java/io/PipedInputStream.java b/java/io/PipedInputStream.java
index 97c034bd1..e25f163f6 100644
--- a/java/io/PipedInputStream.java
+++ b/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;