--- old/jdk/src/jdk.jline/share/classes/jdk/internal/jline/console/internal/ConsoleReaderInputStream.java 2015-06-18 03:06:12.367298416 -0700 +++ new/jdk/src/jdk.jline/share/classes/jdk/internal/jline/console/internal/ConsoleReaderInputStream.java 2015-06-18 03:06:12.200297209 -0700 @@ -6,10 +6,10 @@ * * http://www.opensource.org/licenses/bsd-license.php */ -package jline.console.internal; - -import jline.console.ConsoleReader; - +package jdk.internal.jline.console.internal; + +import jdk.internal.jline.console.ConsoleReader; + import java.io.IOException; import java.io.InputStream; import java.io.SequenceInputStream; @@ -28,63 +28,63 @@ extends SequenceInputStream { private static InputStream systemIn = System.in; - + public static void setIn() throws IOException { setIn(new ConsoleReader()); } - + public static void setIn(final ConsoleReader reader) { System.setIn(new ConsoleReaderInputStream(reader)); } - + /** * Restore the original {@link System#in} input stream. */ public static void restoreIn() { System.setIn(systemIn); } - + public ConsoleReaderInputStream(final ConsoleReader reader) { super(new ConsoleEnumeration(reader)); } - + private static class ConsoleEnumeration - implements Enumeration + implements Enumeration { private final ConsoleReader reader; private ConsoleLineInputStream next = null; private ConsoleLineInputStream prev = null; - + public ConsoleEnumeration(final ConsoleReader reader) { this.reader = reader; } - - public Object nextElement() { + + public InputStream nextElement() { if (next != null) { InputStream n = next; prev = next; next = null; - + return n; } - + return new ConsoleLineInputStream(reader); } - + public boolean hasMoreElements() { // the last line was null if ((prev != null) && (prev.wasNull == true)) { return false; } - + if (next == null) { next = (ConsoleLineInputStream) nextElement(); } - + return next != null; } } - + private static class ConsoleLineInputStream extends InputStream { @@ -93,31 +93,31 @@ private int index = 0; private boolean eol = false; protected boolean wasNull = false; - + public ConsoleLineInputStream(final ConsoleReader reader) { this.reader = reader; } - + public int read() throws IOException { if (eol) { return -1; } - + if (line == null) { line = reader.readLine(); } - + if (line == null) { wasNull = true; return -1; } - + if (index >= line.length()) { eol = true; return '\n'; // lines are ended with a newline } - + return line.charAt(index++); } } -} \ No newline at end of file +}