DataInputStream.java (readLine): Corrected handling of empty lines, from null to "".
1999-04-12 Urban Widmark <urban@svenskatest.se> * java/io/DataInputStream.java (readLine): Corrected handling of empty lines, from null to "". From-SVN: r26381
This commit is contained in:
parent
edcc5d3c96
commit
808ce120ae
@ -1,3 +1,8 @@
|
|||||||
|
1999-04-12 Urban Widmark <urban@svenskatest.se>
|
||||||
|
|
||||||
|
* java/io/DataInputStream.java (readLine): Corrected handling of
|
||||||
|
empty lines, from null to "".
|
||||||
|
|
||||||
1999-04-12 Tom Tromey <tromey@cygnus.com>
|
1999-04-12 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
* Makefile.in: Rebuilt.
|
* Makefile.in: Rebuilt.
|
||||||
|
@ -105,8 +105,11 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
char ch = (char) read();
|
int c = read();
|
||||||
if (ch < 0 || (ch &= 0xFF) == '\n')
|
if (c < 0) // got an EOF
|
||||||
|
return strb.length() > 0 ? strb.toString() : null;
|
||||||
|
char ch = (char) c;
|
||||||
|
if ((ch &= 0xFF) == '\n')
|
||||||
break;
|
break;
|
||||||
if (ch == '\r')
|
if (ch == '\r')
|
||||||
{
|
{
|
||||||
@ -148,7 +151,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
|||||||
strb.append(ch);
|
strb.append(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return strb.length() > 0 ? strb.toString() : null;
|
return strb.length() > 0 ? strb.toString() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public final long readLong() throws IOException
|
public final long readLong() throws IOException
|
||||||
|
Loading…
Reference in New Issue
Block a user