diff options
Diffstat (limited to 'org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java')
-rw-r--r-- | org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java index 04bc9468f..d4442f41e 100644 --- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java +++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -54,11 +54,6 @@ public class IOConsoleInputStream extends InputStream { private int size = 0; /** - * Flag to indicate that EOF has been sent already. - */ - private boolean eofSent = false; - - /** * Flag to indicate that the stream has been closed. */ private boolean closed = false; @@ -90,8 +85,12 @@ public class IOConsoleInputStream extends InputStream { @Override public synchronized int read(byte[] b, int off, int len) throws IOException { + if (len == 0) { + return 0; // behavior as specified in InputStream#read(byte[], int, int) + } + waitForData(); - if (available() == -1) { + if (available() <= 0) { return -1; } @@ -118,7 +117,7 @@ public class IOConsoleInputStream extends InputStream { @Override public synchronized int read() throws IOException { waitForData(); - if (available() == -1) { + if (available() <= 0) { return -1; } @@ -252,14 +251,6 @@ public class IOConsoleInputStream extends InputStream { @Override public int available() throws IOException { - if (closed && eofSent) { - throw new IOException("Input Stream Closed"); //$NON-NLS-1$ - } else if (size == 0) { - if (!eofSent) { - eofSent = true; - return -1; - } - } return size; } |