--- old/jdk/src/jdk.jline/share/classes/jdk/internal/jline/internal/InputStreamReader.java 2015-06-18 03:06:14.936316998 -0700 +++ new/jdk/src/jdk.jline/share/classes/jdk/internal/jline/internal/InputStreamReader.java 2015-06-18 03:06:14.758315709 -0700 @@ -6,7 +6,7 @@ * * http://www.opensource.org/licenses/bsd-license.php */ -package jline.internal; +package jdk.internal.jline.internal; import java.io.IOException; import java.io.InputStream; @@ -39,7 +39,7 @@ * "file.encoding" system property. {@code InputStreamReader} contains a buffer * of bytes read from the source stream and converts these into characters as * needed. The buffer size is 8K. - * + * * @see OutputStreamWriter */ public class InputStreamReader extends Reader { @@ -60,7 +60,7 @@ * {@code in}. This constructor sets the character converter to the encoding * specified in the "file.encoding" property and falls back to ISO 8859_1 * (ISO-Latin-1) if the property doesn't exist. - * + * * @param in * the input stream from which to read characters. */ @@ -80,7 +80,7 @@ * character converter that is used to decode bytes into characters is * identified by name by {@code enc}. If the encoding cannot be found, an * UnsupportedEncodingException error is thrown. - * + * * @param in * the InputStream from which to read characters. * @param enc @@ -111,7 +111,7 @@ /** * Constructs a new InputStreamReader on the InputStream {@code in} and * CharsetDecoder {@code dec}. - * + * * @param in * the source InputStream from which to read characters. * @param dec @@ -128,7 +128,7 @@ /** * Constructs a new InputStreamReader on the InputStream {@code in} and * Charset {@code charset}. - * + * * @param in * the source InputStream from which to read characters. * @param charset @@ -146,7 +146,7 @@ /** * Closes this reader. This implementation closes the source InputStream and * releases all local storage. - * + * * @throws IOException * if an error occurs attempting to close this reader. */ @@ -164,7 +164,7 @@ /** * Returns the name of the encoding used to convert bytes into characters. * The value {@code null} is returned if this reader has been closed. - * + * * @return the name of the character converter or {@code null} if this * reader is closed. */ @@ -181,7 +181,7 @@ * reader has been reached. The byte value is either obtained from * converting bytes in this reader's buffer or by first filling the buffer * from the source InputStream and then reading from the buffer. - * + * * @return the character read or -1 if the end of the reader has been * reached. * @throws IOException @@ -206,7 +206,7 @@ * been reached. The bytes are either obtained from converting bytes in this * reader's buffer or by first filling the buffer from the source * InputStream and then reading from the buffer. - * + * * @param buf * the array to store the characters read. * @param offset @@ -247,7 +247,7 @@ // fill the buffer if needed if (needInput) { try { - if ((in.available() == 0) + if ((in.available() == 0) && (out.position() > offset)) { // we could return the result without blocking read break; @@ -316,7 +316,7 @@ * {@code read()} is called. This implementation returns {@code true} if * there are bytes available in the buffer or the source stream has bytes * available. - * + * * @return {@code true} if the receiver will not block when {@code read()} * is called, {@code false} if unknown or blocking will occur. * @throws IOException @@ -335,4 +335,4 @@ } } } -} \ No newline at end of file +}