Commit 1685382e by Tom Tromey Committed by Tom Tromey

DataInputStream.java (readChar): Use readFully.

	* java/io/DataInputStream.java (readChar): Use readFully.
	(readInt): Likewise.
	(readLong): Likewise.
	(readShort): Likewise.
	(readUnsignedShort): Likewise.

From-SVN: r45834
parent 1e013d2e
2001-09-26 Tom Tromey <tromey@redhat.com>
* java/io/DataInputStream.java (readChar): Use readFully.
(readInt): Likewise.
(readLong): Likewise.
(readShort): Likewise.
(readUnsignedShort): Likewise.
2001-09-24 Bryce McKinlay <bryce@waitaki.otago.ac.nz> 2001-09-24 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/lang/PosixProcess.java (exitValue): Implement here. Throw * java/lang/PosixProcess.java (exitValue): Implement here. Throw
......
...@@ -173,9 +173,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -173,9 +173,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
*/ */
public final char readChar() throws IOException public final char readChar() throws IOException
{ {
int count = in.read (buf, 0, 2); readFully (buf, 0, 2);
if (count < 2)
throw new EOFException();
return convertToChar(buf); return convertToChar(buf);
} }
...@@ -303,9 +301,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -303,9 +301,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
*/ */
public final int readInt() throws IOException public final int readInt() throws IOException
{ {
int count = in.read (buf, 0, 4); readFully (buf, 0, 4);
if (count < 4)
throw new EOFException();
return convertToInt(buf); return convertToInt(buf);
} }
...@@ -453,9 +449,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -453,9 +449,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
*/ */
public final long readLong() throws IOException public final long readLong() throws IOException
{ {
int count = in.read(buf, 0, 8); readFully (buf, 0, 8);
if (count < 8)
throw new EOFException();
return convertToLong(buf); return convertToLong(buf);
} }
...@@ -488,9 +482,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -488,9 +482,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
*/ */
public final short readShort() throws IOException public final short readShort() throws IOException
{ {
int count = in.read(buf, 0, 2); readFully (buf, 0, 2);
if (count < 2)
throw new EOFException();
return convertToShort(buf); return convertToShort(buf);
} }
...@@ -542,9 +534,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -542,9 +534,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
*/ */
public final int readUnsignedShort() throws IOException public final int readUnsignedShort() throws IOException
{ {
int count = in.read(buf, 0, 2); readFully (buf, 0, 2);
if (count < 2)
throw new EOFException();
return convertToUnsignedShort(buf); return convertToUnsignedShort(buf);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment