diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-04-21 21:41:32 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-04-21 21:41:32 +0000 |
commit | 6cd167e1a7f8c13bbc51393aef6c7bd6f0f50075 (patch) | |
tree | 68700a10d2ec54f555f52f3d62ae77bc56a2da46 /libjava/java/io/PipedInputStream.java | |
parent | 7f13af23a55bc12a4d2ea9ac673e89a1a39ccd48 (diff) | |
download | gcc-6cd167e1a7f8c13bbc51393aef6c7bd6f0f50075.zip gcc-6cd167e1a7f8c13bbc51393aef6c7bd6f0f50075.tar.gz gcc-6cd167e1a7f8c13bbc51393aef6c7bd6f0f50075.tar.bz2 |
PipedInputStream.java, [...]: Yet another new version from Classpath.
* java/io/PipedInputStream.java, java/io/PipedOutputStream.java:
Yet another new version from Classpath.
From-SVN: r33328
Diffstat (limited to 'libjava/java/io/PipedInputStream.java')
-rw-r--r-- | libjava/java/io/PipedInputStream.java | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java index 97c034b..e25f163 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; |