summaryrefslogtreecommitdiff
path: root/java/io/DataInputStream.java
diff options
context:
space:
mode:
authorAaron M. Renn <arenn@urbanophile.com>1998-11-29 23:30:50 +0000
committerAaron M. Renn <arenn@urbanophile.com>1998-11-29 23:30:50 +0000
commit147cff711d638483d3ee7b8a376e7269271d7da4 (patch)
tree2ded2c0c519f5865f223d0246213270037665f0d /java/io/DataInputStream.java
parentf7c55d17e805b50a8b96b1b308223005086fe7bf (diff)
downloadclasspath-147cff711d638483d3ee7b8a376e7269271d7da4.tar.gz
Added read(byte[]) and read(byte[], int, int) to conform to spec
Diffstat (limited to 'java/io/DataInputStream.java')
-rw-r--r--java/io/DataInputStream.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/java/io/DataInputStream.java b/java/io/DataInputStream.java
index f705b93cc..2bf9d1aaa 100644
--- a/java/io/DataInputStream.java
+++ b/java/io/DataInputStream.java
@@ -756,6 +756,51 @@ readFully(byte[] buf, int offset, int len) throws EOFException, IOException
/*************************************************************************/
/**
+ * This method reads bytes from the underlying stream into the specified
+ * byte array buffer. It will attempt to fill the buffer completely, but
+ * may return a short count if there is insufficient data remaining to be
+ * read to fill the buffer.
+ *
+ * @param buf The buffer into which bytes will be read.
+ *
+ * @return The actual number of bytes read, or -1 if end of stream reached
+ * before reading any bytes.
+ *
+ * @exception IOException If an error occurs.
+ */
+public final int
+read(byte[] buf) throws IOException
+{
+ return(read(buf, 0, buf.length));
+}
+
+/*************************************************************************/
+
+/**
+ * This method reads bytes from the underlying stream into the specified
+ * byte array buffer. It will attempt to read <code>len</code> bytes and
+ * will start storing them at position <code>offset</code> into the buffer.
+ * This method can return a short count if there is insufficient data
+ * remaining to be read to complete the desired read length.
+ *
+ * @param buf The buffer into which bytes will be read.
+ * @param offset The offset into the buffer to start storing bytes.
+ * @param len The requested number of bytes to read.
+ *
+ * @return The actual number of bytes read, or -1 if end of stream reached
+ * before reading any bytes.
+ *
+ * @exception IOException If an error occurs.
+ */
+public final int
+read(byte[] buf, int offset, int len) throws IOException
+{
+ return(in.read(buf, offset, len));
+}
+
+/*************************************************************************/
+
+/**
* This method attempts to skip and discard the specified number of bytes
* in the input stream. It may actually skip fewer bytes than requested.
* The actual number of bytes skipped is returned. This method will not