This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: DataInputStream fix
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Subject: Patch: FYI: DataInputStream fix
- From: Tom Tromey <tromey at redhat dot com>
- Date: 26 Sep 2001 16:59:17 -0600
- Reply-To: tromey at redhat dot com
I'm checking this in.
This fixes a problem pointed out on the main list.
Tom
2001-09-26 Tom Tromey <tromey@redhat.com>
* java/io/DataInputStream.java (readChar): Use readFully.
(readInt): Likewise.
(readLong): Likewise.
(readShort): Likewise.
(readUnsignedShort): Likewise.
Index: java/io/DataInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/DataInputStream.java,v
retrieving revision 1.10
diff -u -r1.10 DataInputStream.java
--- java/io/DataInputStream.java 2001/02/17 15:09:46 1.10
+++ java/io/DataInputStream.java 2001/09/26 22:48:06
@@ -173,9 +173,7 @@
*/
public final char readChar() throws IOException
{
- int count = in.read (buf, 0, 2);
- if (count < 2)
- throw new EOFException();
+ readFully (buf, 0, 2);
return convertToChar(buf);
}
@@ -303,9 +301,7 @@
*/
public final int readInt() throws IOException
{
- int count = in.read (buf, 0, 4);
- if (count < 4)
- throw new EOFException();
+ readFully (buf, 0, 4);
return convertToInt(buf);
}
@@ -453,9 +449,7 @@
*/
public final long readLong() throws IOException
{
- int count = in.read(buf, 0, 8);
- if (count < 8)
- throw new EOFException();
+ readFully (buf, 0, 8);
return convertToLong(buf);
}
@@ -488,9 +482,7 @@
*/
public final short readShort() throws IOException
{
- int count = in.read(buf, 0, 2);
- if (count < 2)
- throw new EOFException();
+ readFully (buf, 0, 2);
return convertToShort(buf);
}
@@ -542,9 +534,7 @@
*/
public final int readUnsignedShort() throws IOException
{
- int count = in.read(buf, 0, 2);
- if (count < 2)
- throw new EOFException();
+ readFully (buf, 0, 2);
return convertToUnsignedShort(buf);
}