summaryrefslogtreecommitdiff
path: root/java/io/PipedInputStream.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/io/PipedInputStream.java')
-rw-r--r--java/io/PipedInputStream.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/io/PipedInputStream.java b/java/io/PipedInputStream.java
index 523ae2c70..c0396d206 100644
--- a/java/io/PipedInputStream.java
+++ b/java/io/PipedInputStream.java
@@ -279,6 +279,10 @@ public class PipedInputStream extends InputStream
if (closed)
throw new IOException ("Pipe closed");
+ // Don't block if nothing was requested.
+ if (len == 0)
+ return 0;
+
// If the buffer is empty, wait until there is something in the pipe
// to read.
try