2003-12-28 Guilhem Lavaux <guilhem@kaffe.org>
* java/io/LineNumberReader.java (mark): Improved error checking. (read): Likewise. (skip): Likewise. Skip is now really eating the specified number of characters. * java/io/CharArrayReader.java (read): It should throw IndexOutOfBoundsException and not ArrayIndexOutOfBoundsException (see mauve). * java/io/BufferedReader.java (readLine): Make readLine() really block until either EOF is reached or a true error happens. From-SVN: r75180
This commit is contained in:
parent
07dc48e014
commit
920be544c9
4 changed files with 42 additions and 8 deletions
|
@ -460,12 +460,19 @@ public class BufferedReader extends Reader
|
|||
boolean eof = false;
|
||||
for (;;)
|
||||
{
|
||||
int ch = read();
|
||||
if (ch < 0)
|
||||
// readLine should block. So we must not return until a -1 is reached.
|
||||
if (pos >= limit)
|
||||
{
|
||||
eof = true;
|
||||
break;
|
||||
// here count == 0 isn't sufficient to give a failure.
|
||||
int count = fill();
|
||||
if (count < 0)
|
||||
{
|
||||
eof = true;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int ch = buffer[pos++];
|
||||
if (ch == '\n' || ch == '\r')
|
||||
{
|
||||
// Check here if a '\r' was the last char in the buffer; if so,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue