Commits

Anonymous committed 325ff8c

Clean up the #read javadoc.

By being more consistent in parameter naming, we can inherit more javadoc.

Also fix a couple of javadoc warnings in KnownFailure and DataInputStream.

Change-Id: I778f40469404fb50c51cdb1068970974f923180c

Comments (0)

Files changed (35)

dalvik/src/main/java/dalvik/annotation/KnownFailure.java

 
 /**
  * Marks a test case as a known failure. This means the underlying
- * implementation should be fixed. Seems to be similar to @code{@ToBeFixed}, so
+ * implementation should be fixed. Seems to be similar to {@code @ToBeFixed}, so
  * maybe the two can be merged at some point.
  *
  * @hide

luni/src/main/java/java/io/BufferedInputStream.java

         return -1;
     }
 
-    /**
-     * Reads at most {@code byteCount} bytes from this stream and stores them in
-     * byte array {@code buffer} starting at offset {@code offset}. Returns the
-     * number of bytes actually read or -1 if no bytes were read and the end of
-     * the stream was encountered. If all the buffered bytes have been used, a
-     * mark has not been set and the requested number of bytes is larger than
-     * the receiver's buffer size, this implementation bypasses the buffer and
-     * simply places the results directly into {@code buffer}.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @return the number of bytes actually read or -1 if end of stream.
-     * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code byteCount < 0}, or if
-     *             {@code offset + byteCount} is greater than the size of
-     *             {@code buffer}.
-     * @throws IOException
-     *             if the stream is already closed or another IOException
-     *             occurs.
-     */
-    @Override
-    public synchronized int read(byte[] buffer, int offset, int byteCount) throws IOException {
+    @Override public synchronized int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         // Use local ref since buf may be invalidated by an unsynchronized
         // close()
         byte[] localBuf = buf;
         if (localBuf == null) {
             throw streamClosed();
         }
-        Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
         if (byteCount == 0) {
             return 0;
         }
         if (pos < count) {
             /* There are bytes available in the buffer. */
             int copylength = count - pos >= byteCount ? byteCount : count - pos;
-            System.arraycopy(localBuf, pos, buffer, offset, copylength);
+            System.arraycopy(localBuf, pos, buffer, byteOffset, copylength);
             pos += copylength;
             if (copylength == byteCount || localIn.available() == 0) {
                 return copylength;
             }
-            offset += copylength;
+            byteOffset += copylength;
             required = byteCount - copylength;
         } else {
             required = byteCount;
              * buffer, simply read the bytes directly bypassing the buffer.
              */
             if (markpos == -1 && required >= localBuf.length) {
-                read = localIn.read(buffer, offset, required);
+                read = localIn.read(buffer, byteOffset, required);
                 if (read == -1) {
                     return required == byteCount ? -1 : byteCount - required;
                 }
                 }
 
                 read = count - pos >= required ? required : count - pos;
-                System.arraycopy(localBuf, pos, buffer, offset, read);
+                System.arraycopy(localBuf, pos, buffer, byteOffset, read);
                 pos += read;
             }
             required -= read;
             if (localIn.available() == 0) {
                 return byteCount - required;
             }
-            offset += read;
+            byteOffset += read;
         }
     }
 

luni/src/main/java/java/io/BufferedReader.java

     }
 
     /**
-     * Reads at most {@code length} characters from this reader and stores them
+     * Reads up to {@code length} characters from this reader and stores them
      * at {@code offset} in the character array {@code buffer}. Returns the
      * number of characters actually read or -1 if the end of the source reader
      * has been reached. If all the buffered characters have been used, a mark
      * this readers buffer size, BufferedReader bypasses the buffer and simply
      * places the results directly into {@code buffer}.
      *
-     * @param buffer
-     *            the character array to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the chars read
-     *            from this reader.
-     * @param length
-     *            the maximum number of characters to read, must be
-     *            non-negative.
-     * @return number of characters read or -1 if the end of the source reader
-     *         has been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the size of
-     *             {@code buffer}.
+     *     if {@code offset < 0 || length < 0 || offset + length > buffer.length}.
      * @throws IOException
      *             if this reader is closed or some other I/O error occurs.
      */

luni/src/main/java/java/io/ByteArrayInputStream.java

         return pos < count ? buf[pos++] & 0xFF : -1;
     }
 
-    /**
-     * Reads at most {@code len} bytes from this stream and stores
-     * them in byte array {@code b} starting at {@code offset}. This
-     * implementation reads bytes from the source byte array.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code b} to store the bytes read from
-     *            this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code b}.
-     * @return the number of bytes actually read or -1 if no bytes were read and
-     *         the end of the stream was encountered.
-     * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the size of
-     *             {@code b}.
-     * @throws NullPointerException
-     *             if {@code b} is {@code null}.
-     */
-    @Override
-    public synchronized int read(byte[] buffer, int offset, int length) {
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
+    @Override public synchronized int read(byte[] buffer, int byteOffset, int byteCount) {
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
 
         // Are there any bytes available?
         if (this.pos >= this.count) {
             return -1;
         }
-        if (length == 0) {
+        if (byteCount == 0) {
             return 0;
         }
 
-        int copylen = this.count - pos < length ? this.count - pos : length;
-        System.arraycopy(this.buf, pos, buffer, offset, copylen);
+        int copylen = this.count - pos < byteCount ? this.count - pos : byteCount;
+        System.arraycopy(this.buf, pos, buffer, byteOffset, copylen);
         pos += copylen;
         return copylen;
     }

luni/src/main/java/java/io/CharArrayReader.java

     }
 
     /**
-     * Reads at most {@code count} characters from this CharArrayReader and
-     * stores them at {@code offset} in the character array {@code buf}.
+     * Reads up to {@code count} characters from this CharArrayReader and
+     * stores them at {@code offset} in the character array {@code buffer}.
      * Returns the number of characters actually read or -1 if the end of reader
      * was encountered.
      *
-     * @param buffer
-     *            the character array to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param len
-     *            the maximum number of characters to read.
-     * @return number of characters read or -1 if the end of the reader has been
-     *         reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code len < 0}, or if
-     *             {@code offset + len} is bigger than the size of
-     *             {@code buffer}.
+     * if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
      * @throws IOException
      *             if this reader is closed.
      */
     @Override
-    public int read(char[] buffer, int offset, int len) throws IOException {
-        Arrays.checkOffsetAndCount(buffer.length, offset, len);
+    public int read(char[] buffer, int offset, int count) throws IOException {
+        Arrays.checkOffsetAndCount(buffer.length, offset, count);
         synchronized (lock) {
             checkNotClosed();
             if (pos < this.count) {
-                int bytesRead = pos + len > this.count ? this.count - pos : len;
+                int bytesRead = pos + count > this.count ? this.count - pos : count;
                 System.arraycopy(this.buf, pos, buffer, offset, bytesRead);
                 pos += bytesRead;
                 return bytesRead;

luni/src/main/java/java/io/DataInputStream.java

         return super.read(buffer);
     }
 
-    /**
-     * Reads at most {@code length} bytes from this stream and stores them in
-     * the byte array {@code buffer} starting at {@code offset}. Returns the
-     * number of bytes that have been read or -1 if no bytes have been read and
-     * the end of the stream has been reached.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes
-     *            read from this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes that have been read or -1 if the end of the
-     *         stream has been reached.
-     * @throws IOException
-     *             if a problem occurs while reading from this stream.
-     * @see DataOutput#write(byte[])
-     * @see DataOutput#write(byte[], int, int)
-     */
-    @Override
-    public final int read(byte[] buffer, int offset, int length) throws IOException {
-        return in.read(buffer, offset, length);
+    @Override public final int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        return in.read(buffer, byteOffset, byteCount);
     }
 
     public final boolean readBoolean() throws IOException {
         return Memory.peekInt(scratch, 0, ByteOrder.BIG_ENDIAN);
     }
 
+    /**
+     * @deprecated This method cannot be trusted to convert bytes to characters correctly.
+     * Wrap this stream with a {@link BufferedReader} instead.
+     */
     @Deprecated
     public final String readLine() throws IOException {
         StringBuilder line = new StringBuilder(80); // Typical line length

luni/src/main/java/java/io/FilterInputStream.java

         return in.read();
     }
 
-    /**
-     * Reads at most {@code count} bytes from this stream and stores them in the
-     * byte array {@code buffer} starting at {@code offset}. Returns the number
-     * of bytes actually read or -1 if no bytes have been read and the end of
-     * this stream has been reached. This implementation reads bytes from the
-     * filtered stream.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes
-     *            read from this stream.
-     * @param count
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes actually read or -1 if the end of the
-     *         filtered stream has been reached while reading.
-     * @throws IOException
-     *             if this stream is closed or another I/O error occurs.
-     */
-    @Override
-    public int read(byte[] buffer, int offset, int count) throws IOException {
-        return in.read(buffer, offset, count);
+    @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        return in.read(buffer, byteOffset, byteCount);
     }
 
     /**

luni/src/main/java/java/io/FilterReader.java

     }
 
     /**
-     * Reads at most {@code count} characters from the filtered reader and stores them
+     * Reads up to {@code count} characters from the filtered reader and stores them
      * in the byte array {@code buffer} starting at {@code offset}. Returns the
      * number of characters actually read or -1 if no characters were read and
      * the end of the filtered reader was encountered.
      *
-     * @param buffer
-     *            the char array in which to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param count
-     *            the maximum number of characters to store in {@code buffer}.
-     * @return the number of characters actually read or -1 if the end of the
-     *         filtered reader has been reached while reading.
      * @throws IOException
      *             if an error occurs while reading from this reader.
      */

luni/src/main/java/java/io/InputStream.java

      * reached. Blocks until one byte has been read, the end of the source
      * stream is detected or an exception is thrown.
      *
-     * @return the byte read or -1 if the end of stream has been reached.
      * @throws IOException
      *             if the stream is closed or another IOException occurs.
      */
     }
 
     /**
-     * Reads at most {@code length} bytes from this stream and stores them in
-     * the byte array {@code b} starting at {@code offset}.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes read
-     *            from this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code b}.
-     * @return the number of bytes actually read or -1 if the end of the stream
-     *         has been reached.
+     * Reads up to {@code byteCount} bytes from this stream and stores them in
+     * the byte array {@code buffer} starting at {@code byteOffset}.
+     * Returns the number of bytes actually read or -1 if the end of the stream
+     * has been reached.
+     *
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code b}.
+     *   if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}.
      * @throws IOException
      *             if the stream is closed or another IOException occurs.
      */
-    public int read(byte[] buffer, int offset, int length) throws IOException {
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
-        for (int i = 0; i < length; i++) {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
+        for (int i = 0; i < byteCount; ++i) {
             int c;
             try {
                 if ((c = read()) == -1) {
                 }
                 throw e;
             }
-            buffer[offset + i] = (byte) c;
+            buffer[byteOffset + i] = (byte) c;
         }
-        return length;
+        return byteCount;
     }
 
     /**

luni/src/main/java/java/io/InputStreamReader.java

     }
 
     /**
-     * Reads at most {@code length} characters from this reader and stores them
-     * at position {@code offset} in the character array {@code buf}. Returns
+     * Reads up to {@code count} characters from this reader and stores them
+     * at position {@code offset} in the character array {@code buffer}. Returns
      * the number of characters actually read or -1 if the end of the reader has
      * been reached. The bytes are either obtained from converting bytes in this
      * reader's buffer or by first filling the buffer from the source
      * InputStream and then reading from the buffer.
      *
-     * @param buffer
-     *            the array to store the characters read.
-     * @param offset
-     *            the initial position in {@code buf} to store the characters
-     *            read from this reader.
-     * @param length
-     *            the maximum number of characters to read.
-     * @return the number of characters read or -1 if the end of the reader has
-     *         been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code buf}.
+     *     if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
      * @throws IOException
      *             if this reader is closed or some other I/O error occurs.
      */
     @Override
-    public int read(char[] buffer, int offset, int length) throws IOException {
+    public int read(char[] buffer, int offset, int count) throws IOException {
         synchronized (lock) {
             if (!isOpen()) {
                 throw new IOException("InputStreamReader is closed");
             }
 
-            Arrays.checkOffsetAndCount(buffer.length, offset, length);
-            if (length == 0) {
+            Arrays.checkOffsetAndCount(buffer.length, offset, count);
+            if (count == 0) {
                 return 0;
             }
 
-            CharBuffer out = CharBuffer.wrap(buffer, offset, length);
+            CharBuffer out = CharBuffer.wrap(buffer, offset, count);
             CoderResult result = CoderResult.UNDERFLOW;
 
             // bytes.remaining() indicates number of bytes in buffer

luni/src/main/java/java/io/LineNumberInputStream.java

     }
 
     /**
-     * Reads at most {@code length} bytes from the filtered stream and stores
-     * them in the byte array {@code buffer} starting at {@code offset}.
+     * Reads up to {@code byteCount} bytes from the filtered stream and stores
+     * them in the byte array {@code buffer} starting at {@code byteOffset}.
      * Returns the number of bytes actually read or -1 if no bytes have been
      * read and the end of this stream has been reached.
-     * <p>
-     * The line number count is incremented if a line terminator is encountered.
+     *
+     * <p>The line number count is incremented if a line terminator is encountered.
      * Recognized line terminator sequences are {@code '\r'}, {@code '\n'} and
      * {@code "\r\n"}. Line terminator sequences are always translated into
      * {@code '\n'}.
      *
-     * @param buffer
-     *            the array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes read
-     *            from this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes actually read or -1 if the end of the
-     *         filtered stream has been reached while reading.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code buffer}.
+     *     if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}.
      * @throws IOException
      *             if this stream is closed or another IOException occurs.
      * @throws NullPointerException
-     *             if {@code buffer} is {@code null}.
+     *             if {@code buffer == null}.
      */
     @Override
-    public int read(byte[] buffer, int offset, int length) throws IOException {
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
-        for (int i = 0; i < length; i++) {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
+        for (int i = 0; i < byteCount; ++i) {
             int currentChar;
             try {
                 currentChar = read();
             if (currentChar == -1) {
                 return i == 0 ? -1 : i;
             }
-            buffer[offset + i] = (byte) currentChar;
+            buffer[byteOffset + i] = (byte) currentChar;
         }
-        return length;
+        return byteCount;
     }
 
     /**

luni/src/main/java/java/io/LineNumberReader.java

     }
 
     /**
-     * Reads at most {@code count} characters from the source reader and stores
+     * Reads up to {@code count} characters from the source reader and stores
      * them in the character array {@code buffer} starting at {@code offset}.
      * Returns the number of characters actually read or -1 if no characters
      * have been read and the end of this reader has been reached.
-     * <p>
-     * The line number count is incremented if a line terminator is encountered.
+     *
+     * <p>The line number count is incremented if a line terminator is encountered.
      * Recognized line terminator sequences are {@code '\r'}, {@code '\n'} and
      * {@code "\r\n"}.
      *
-     * @param buffer
-     *            the array in which to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param count
-     *            the maximum number of characters to store in {@code buffer}.
-     * @return the number of characters actually read or -1 if the end of the
-     *         source reader has been reached while reading.
      * @throws IOException
      *             if this reader is closed or another IOException occurs.
      */

luni/src/main/java/java/io/ObjectInput.java

 
     /**
      * Reads bytes from this stream into the byte array {@code buffer}. Blocks
-     * while waiting for input.
+     * while waiting for input. Returns the number of bytes read,
+     * or -1 if the end of this stream has been reached.
      *
-     * @param buffer
-     *            the array in which to store the bytes read.
-     * @return the number of bytes read or -1 if the end of this stream has been
-     *         reached.
      * @throws IOException
      *             if this stream is closed or another I/O error occurs.
      */
     public int read(byte[] buffer) throws IOException;
 
     /**
-     * Reads at most {@code count} bytes from this stream and stores them in
-     * byte array {@code buffer} starting at offset {@code count}. Blocks while
-     * waiting for input.
+     * Reads up to {@code byteCount} bytes from this stream and stores them in
+     * byte array {@code buffer} starting at offset {@code byteOffset}. Blocks while
+     * waiting for input. Returns the number of bytes read or -1 if the end of this stream has been
+     * reached.
      *
-     * @param buffer
-     *            the array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes read
-     *            from this stream.
-     * @param count
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes read or -1 if the end of this stream has been
-     *         reached.
      * @throws IOException
      *             if this stream is closed or another I/O error occurs.
      */
-    public int read(byte[] buffer, int offset, int count) throws IOException;
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException;
 
     /**
      * Reads the next object from this stream.

luni/src/main/java/java/io/ObjectInputStream.java

         return primitiveData.read();
     }
 
-    /**
-     * Reads at most {@code length} bytes from the source stream and stores them
-     * in byte array {@code buffer} starting at offset {@code count}. Blocks
-     * until {@code count} bytes have been read, the end of the source stream is
-     * detected or an exception is thrown.
-     *
-     * @param buffer
-     *            the array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes
-     *            read from the source stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes read or -1 if the end of the source input
-     *         stream has been reached.
-     * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code buffer}.
-     * @throws IOException
-     *             if an error occurs while reading from this stream.
-     * @throws NullPointerException
-     *             if {@code buffer} is {@code null}.
-     */
-    @Override
-    public int read(byte[] buffer, int offset, int length) throws IOException {
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
-        if (length == 0) {
+    @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
+        if (byteCount == 0) {
             return 0;
         }
         checkReadPrimitiveTypes();
-        return primitiveData.read(buffer, offset, length);
+        return primitiveData.read(buffer, byteOffset, byteCount);
     }
 
     /**

luni/src/main/java/java/io/PipedInputStream.java

     }
 
     /**
-     * Reads at most {@code byteCount} bytes from this stream and stores them in the
-     * byte array {@code bytes} starting at {@code offset}. Blocks until at
+     * Reads up to {@code byteCount} bytes from this stream and stores them in the
+     * byte array {@code bytes} starting at {@code byteOffset}. Blocks until at
      * least one byte has been read, the end of the stream is detected or an
      * exception is thrown.
-     * <p>
-     * Separate threads should be used to read from a {@code PipedInputStream}
+     *
+     * <p>Separate threads should be used to read from a {@code PipedInputStream}
      * and to write to the connected {@link PipedOutputStream}. If the same
      * thread is used, a deadlock may occur.
      *
-     * @return the number of bytes actually read or -1 if the end of the stream
-     *         has been reached.
+     * <p>Returns the number of bytes actually read or -1 if the end of the stream
+     * has been reached.
+     *
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code byteCount < 0}, or if {@code
-     *             offset + byteCount} is greater than the size of {@code bytes}.
+     *     if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > bytes.length}.
      * @throws InterruptedIOException
      *             if the thread reading from this stream is interrupted.
      * @throws IOException
      * @throws NullPointerException
      *             if {@code bytes} is {@code null}.
      */
-    @Override
-    public synchronized int read(byte[] bytes, int offset, int byteCount) throws IOException {
-        Arrays.checkOffsetAndCount(bytes.length, offset, byteCount);
+    @Override public synchronized int read(byte[] bytes, int byteOffset, int byteCount) throws IOException {
+        Arrays.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
         if (byteCount == 0) {
             return 0;
         }
         if (out >= in) {
             int leftInBuffer = buffer.length - out;
             int length = leftInBuffer < byteCount ? leftInBuffer : byteCount;
-            System.arraycopy(buffer, out, bytes, offset, length);
+            System.arraycopy(buffer, out, bytes, byteOffset, length);
             out += length;
             if (out == buffer.length) {
                 out = 0;
             int leftInBuffer = in - out;
             int leftToCopy = byteCount - totalCopied;
             int length = leftToCopy < leftInBuffer ? leftToCopy : leftInBuffer;
-            System.arraycopy(buffer, out, bytes, offset + totalCopied, length);
+            System.arraycopy(buffer, out, bytes, byteOffset + totalCopied, length);
             out += length;
             if (out == in) {
                 // empty buffer

luni/src/main/java/java/io/PipedReader.java

     }
 
     /**
-     * Reads at most {@code count} characters from this reader and stores them
+     * Reads up to {@code count} characters from this reader and stores them
      * in the character array {@code buffer} starting at {@code offset}. If
      * there is no data in the pipe, this method blocks until at least one byte
      * has been read, the end of the reader is detected or an exception is
      * thrown.
-     * <p>
-     * Separate threads should be used to read from a {@code PipedReader} and to
+     *
+     * <p>Separate threads should be used to read from a {@code PipedReader} and to
      * write to the connected {@link PipedWriter}. If the same thread is used, a
      * deadlock may occur.
      *
-     * @param buffer
-     *            the character array in which to store the characters read.
-     * @param offset
-     *            the initial position in {@code bytes} to store the characters
-     *            read from this reader.
-     * @param count
-     *            the maximum number of characters to store in {@code buffer}.
-     * @return the number of characters read or -1 if the end of the reader has
-     *         been reached.
+     * <p>Returns the number of characters read or -1 if the end of the reader has
+     * been reached.
+     *
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code count < 0}, or if {@code
-     *             offset + count} is greater than the size of {@code buffer}.
+     *     if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
      * @throws InterruptedIOException
      *             if the thread reading from this reader is interrupted.
      * @throws IOException
      *             the thread writing to the connected writer is no longer
      *             alive.
      */
-    @Override
-    public synchronized int read(char[] buffer, int offset, int count) throws IOException {
+    @Override public synchronized int read(char[] buffer, int offset, int count) throws IOException {
         if (!isConnected) {
             throw new IOException("Pipe not connected");
         }

luni/src/main/java/java/io/PushbackInputStream.java

     }
 
     /**
-     * Reads at most {@code length} bytes from this stream and stores them in
-     * the byte array {@code buffer} starting at {@code offset}. Bytes are read
+     * Reads up to {@code byteCount} bytes from this stream and stores them in
+     * the byte array {@code buffer} starting at {@code byteOffset}. Bytes are read
      * from the pushback buffer first, then from the source stream if more bytes
-     * are required. Blocks until {@code count} bytes have been read, the end of
-     * the source stream is detected or an exception is thrown.
+     * are required. Blocks until {@code byteCount} bytes have been read, the end of
+     * the source stream is detected or an exception is thrown. Returns the number of bytes read,
+     * or -1 if the end of the source stream has been reached.
      *
-     * @param buffer
-     *            the array in which to store the bytes read from this stream.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes read
-     *            from this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes read or -1 if the end of the source stream
-     *         has been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code buffer}.
+     *     if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}.
      * @throws IOException
      *             if this stream is closed or another I/O error occurs while
      *             reading from this stream.
      * @throws NullPointerException
-     *             if {@code buffer} is {@code null}.
+     *             if {@code buffer == null}.
      */
     @Override
-    public int read(byte[] buffer, int offset, int length) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         if (buf == null) {
             throw streamClosed();
         }
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
-        int copiedBytes = 0, copyLength = 0, newOffset = offset;
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
+        int copiedBytes = 0, copyLength = 0, newOffset = byteOffset;
         // Are there pushback bytes available?
         if (pos < buf.length) {
-            copyLength = (buf.length - pos >= length) ? length : buf.length
-                    - pos;
+            copyLength = (buf.length - pos >= byteCount) ? byteCount : buf.length - pos;
             System.arraycopy(buf, pos, buffer, newOffset, copyLength);
             newOffset += copyLength;
             copiedBytes += copyLength;
             pos += copyLength;
         }
         // Have we copied enough?
-        if (copyLength == length) {
-            return length;
+        if (copyLength == byteCount) {
+            return byteCount;
         }
-        int inCopied = in.read(buffer, newOffset, length - copiedBytes);
+        int inCopied = in.read(buffer, newOffset, byteCount - copiedBytes);
         if (inCopied > 0) {
             return inCopied + copiedBytes;
         }

luni/src/main/java/java/io/PushbackReader.java

     }
 
     /**
-     * Reads at most {@code length} bytes from this reader and stores them in
-     * byte array {@code buffer} starting at {@code offset}. Characters are
+     * Reads up to {@code count} characters from this reader and stores them in
+     * character array {@code buffer} starting at {@code offset}. Characters are
      * read from the pushback buffer first, then from the source reader if more
      * bytes are required. Blocks until {@code count} characters have been read,
      * the end of the source reader is detected or an exception is thrown.
+     * Returns the number of bytes read or -1 if the end of the source reader has been reached.
      *
-     * @param buffer
-     *            the array in which to store the characters read from this
-     *            reader.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param count
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes read or -1 if the end of the source reader
-     *         has been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code count < 0}, or if
-     *             {@code offset + count} is greater than the length of
-     *             {@code buffer}.
+     *     if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
      * @throws IOException
      *             if this reader is closed or another I/O error occurs while
      *             reading from this reader.

luni/src/main/java/java/io/RandomAccessFile.java

      * byte array {@code buffer}. The maximum number of bytes read corresponds
      * to the size of {@code buffer}. Blocks until at least one byte has been
      * read, the end of the file is detected, or an exception is thrown.
+     * Returns the number of bytes actually read or -1 if the end of the file
+     * has been reached. See also {@link #readFully}.
      *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @return the number of bytes actually read or -1 if the end of the file
-     *         has been reached.
      * @throws IOException
      *             if this file is closed or another I/O error occurs.
      */
     }
 
     /**
-     * Reads at most {@code byteCount} bytes from the current position in this file
+     * Reads up to {@code byteCount} bytes from the current position in this file
      * and stores them in the byte array {@code buffer} starting at {@code
      * byteOffset}. Blocks until at least one byte has been
      * read, the end of the file is detected, or an exception is thrown.
+     * Returns the number of bytes actually read or -1 if the end of the stream has been reached.
+     * See also {@link #readFully}.
      *
-     * @return the number of bytes actually read or -1 if the end of the stream
-     *         has been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code byteOffset < 0} or {@code byteCount < 0}, or if {@code
-     *             byteOffset + byteCount} is greater than the size of {@code buffer}.
+     *     if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}.
      * @throws IOException
      *             if this file is closed or another I/O error occurs.
      */

luni/src/main/java/java/io/Reader.java

 
     /**
      * Reads characters from this reader and stores them in the character array
-     * {@code buf} starting at offset 0. Returns the number of characters
+     * {@code buffer} starting at offset 0. Returns the number of characters
      * actually read or -1 if the end of the reader has been reached.
      *
-     * @param buf
-     *            character array to store the characters read.
-     * @return the number of characters read or -1 if the end of the reader has
-     *         been reached.
      * @throws IOException
      *             if this reader is closed or some other I/O error occurs.
      */
-    public int read(char[] buf) throws IOException {
-        return read(buf, 0, buf.length);
+    public int read(char[] buffer) throws IOException {
+        return read(buffer, 0, buffer.length);
     }
 
     /**
-     * Reads at most {@code count} characters from this reader and stores them
-     * at {@code offset} in the character array {@code buf}. Returns the number
+     * Reads up to {@code count} characters from this reader and stores them
+     * at {@code offset} in the character array {@code buffer}. Returns the number
      * of characters actually read or -1 if the end of the reader has been
      * reached.
      *
-     * @param buf
-     *            the character array to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param count
-     *            the maximum number of characters to read.
-     * @return the number of characters read or -1 if the end of the reader has
-     *         been reached.
      * @throws IOException
      *             if this reader is closed or some other I/O error occurs.
      */
-    public abstract int read(char[] buf, int offset, int count) throws IOException;
+    public abstract int read(char[] buffer, int offset, int count) throws IOException;
 
     /**
      * Indicates whether this reader is ready to be read without blocking.

luni/src/main/java/java/io/SequenceInputStream.java

     }
 
     /**
-     * Reads at most {@code count} bytes from this sequence of input streams and
-     * stores them in the byte array {@code buffer} starting at {@code offset}.
+     * Reads up to {@code byteCount} bytes from this sequence of input streams and
+     * stores them in the byte array {@code buffer} starting at {@code byteOffset}.
      * Blocks only until at least 1 byte has been read, the end of the stream
      * has been reached, or an exception is thrown.
      * <p>
      * This SequenceInputStream shows the same behavior as other InputStreams.
      * To do this it will read only as many bytes as a call to read on the
      * current substream returns. If that call does not return as many bytes as
-     * requested by {@code count}, it will not retry to read more on its own
+     * requested by {@code byteCount}, it will not retry to read more on its own
      * because subsequent reads might block. This would violate the rule that
      * it will only block until at least one byte has been read.
      * <p>
      * will close that substream and start with the next one. If there are no
      * more substreams it will return -1.
      *
-     * @param buffer
-     *            the array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the bytes read
-     *            from this stream.
-     * @param count
-     *            the maximum number of bytes to store in {@code buffer}.
-     * @return the number of bytes actually read; -1 if this sequence of streams
-     *         is closed or if the end of the last stream in the sequence has
-     *         been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code count < 0}, or if {@code
-     *             offset + count} is greater than the size of {@code buffer}.
+     *     if {@code byteOffset < 0 || byteCount < 0 || byteOffset + byteCount > buffer.length}.
      * @throws IOException
      *             if an I/O error occurs.
      * @throws NullPointerException
-     *             if {@code buffer} is {@code null}.
+     *             if {@code buffer == null}.
      */
     @Override
-    public int read(byte[] buffer, int offset, int count) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         if (in == null) {
             return -1;
         }
-        Arrays.checkOffsetAndCount(buffer.length, offset, count);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
         while (in != null) {
-            int result = in.read(buffer, offset, count);
+            int result = in.read(buffer, byteOffset, byteCount);
             if (result >= 0) {
                 return result;
             }

luni/src/main/java/java/io/StringBufferInputStream.java

         return pos < count ? buffer.charAt(pos++) & 0xFF : -1;
     }
 
-    /**
-     * Reads at most {@code length} bytes from the source string and stores them
-     * in the byte array {@code b} starting at {@code offset}.
-     *
-     * @param buffer
-     *            the byte array in which to store the bytes read.
-     * @param offset
-     *            the initial position in {@code b} to store the bytes read from
-     *            this stream.
-     * @param length
-     *            the maximum number of bytes to store in {@code b}.
-     * @return the number of bytes actually read or -1 if the end of the source
-     *         string has been reached.
-     * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code length < 0}, or if
-     *             {@code offset + length} is greater than the length of
-     *             {@code b}.
-     * @throws NullPointerException
-     *             if {@code b} is {@code null}.
-     */
-    @Override
-    public synchronized int read(byte[] buffer, int offset, int length) {
+    @Override public synchronized int read(byte[] buffer, int byteOffset, int byteCount) {
         if (buffer == null) {
             throw new NullPointerException("buffer == null");
         }
-        Arrays.checkOffsetAndCount(buffer.length, offset, length);
-        if (length == 0) {
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
+        if (byteCount == 0) {
             return 0;
         }
 
-        int copylen = count - pos < length ? count - pos : length;
-        for (int i = 0; i < copylen; i++) {
-            buffer[offset + i] = (byte) this.buffer.charAt(pos + i);
+        int copylen = count - pos < byteCount ? count - pos : byteCount;
+        for (int i = 0; i < copylen; ++i) {
+            buffer[byteOffset + i] = (byte) this.buffer.charAt(pos + i);
         }
         pos += copylen;
         return copylen;

luni/src/main/java/java/io/StringReader.java

     }
 
     /**
-     * Reads at most {@code len} characters from the source string and stores
-     * them at {@code offset} in the character array {@code buf}. Returns the
+     * Reads up to {@code count} characters from the source string and stores
+     * them at {@code offset} in the character array {@code buffer}. Returns the
      * number of characters actually read or -1 if the end of the source string
      * has been reached.
      *
-     * @param buf
-     *            the character array to store the characters read.
-     * @param offset
-     *            the initial position in {@code buffer} to store the characters
-     *            read from this reader.
-     * @param len
-     *            the maximum number of characters to read.
-     * @return the number of characters read or -1 if the end of the reader has
-     *         been reached.
      * @throws IndexOutOfBoundsException
-     *             if {@code offset < 0} or {@code len < 0}, or if
-     *             {@code offset + len} is greater than the size of {@code buf}.
+                if {@code offset < 0 || count < 0 || offset + count > buffer.length}.
      * @throws IOException
      *             if this reader is closed.
      */
     @Override
-    public int read(char[] buf, int offset, int len) throws IOException {
+    public int read(char[] buffer, int offset, int count) throws IOException {
         synchronized (lock) {
             checkNotClosed();
-            Arrays.checkOffsetAndCount(buf.length, offset, len);
-            if (len == 0) {
+            Arrays.checkOffsetAndCount(buffer.length, offset, count);
+            if (count == 0) {
                 return 0;
             }
             if (pos == this.count) {
                 return -1;
             }
-            int end = pos + len > this.count ? this.count : pos + len;
-            str.getChars(pos, end, buf, offset);
+            int end = pos + count > this.count ? this.count : pos + count;
+            str.getChars(pos, end, buffer, offset);
             int read = end - pos;
             pos = end;
             return read;

luni/src/main/java/java/net/PlainSocketImpl.java

             return Streams.readSingleByte(this);
         }
 
-        @Override public int read(byte[] buffer, int offset, int byteCount) throws IOException {
-            return socketImpl.read(buffer, offset, byteCount);
+        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            return socketImpl.read(buffer, byteOffset, byteCount);
         }
     }
 

luni/src/main/java/java/nio/SocketChannelImpl.java

         }
 
         @Override
-        public int read(byte[] buffer, int offset, int byteCount) throws IOException {
-            Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
             if (!channel.isBlocking()) {
                 throw new IllegalBlockingModeException();
             }
-            ByteBuffer buf = ByteBuffer.wrap(buffer, offset, byteCount);
+            ByteBuffer buf = ByteBuffer.wrap(buffer, byteOffset, byteCount);
             return channel.read(buf);
         }
     }

luni/src/main/java/java/nio/channels/Channels.java

             return Streams.readSingleByte(this);
         }
 
-        @Override public synchronized int read(byte[] target, int offset, int length) throws IOException {
-            ByteBuffer buffer = ByteBuffer.wrap(target, offset, length);
+        @Override public synchronized int read(byte[] target, int byteOffset, int byteCount) throws IOException {
+            ByteBuffer buffer = ByteBuffer.wrap(target, byteOffset, byteCount);
             checkBlocking(channel);
             return channel.read(buffer);
         }

luni/src/main/java/java/security/DigestInputStream.java

     }
 
     /**
-     * Reads {@code len} bytes into the specified {@code byte[]}, starting from
-     * the specified offset. Updates the digest if this function is
+     * Reads up to {@code byteCount} bytes into {@code buffer}, starting at
+     * {@code byteOffset}. Updates the digest if this function is
      * {@link #on(boolean)}.
-     * <p>
-     * This operation is blocking.
      *
-     * @param b
-     *            the byte array in which to store the bytes
-     * @param off
-     *            the initial position in {@code b} to store the bytes read from
-     *            this stream
-     * @param len
-     *            the maximum number of bytes to store in {@code b}
-     * @return the number of bytes actually read or -1 if the end of the
-     *         filtered stream has been reached while reading
+     * <p>This operation is blocking.
+     *
+     * <p>Returns the number of bytes actually read or -1 if the end of the
+     * filtered stream has been reached while reading.
+     *
      * @throws IOException
      *             if reading the source stream causes an {@code IOException}
      */
     @Override
-    public int read(byte[] b, int off, int len) throws IOException {
-        // read next up to len bytes
-        int bytesRead = in.read(b, off, len);
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        int bytesRead = in.read(buffer, byteOffset, byteCount);
         // update digest only if
         // - digest functionality is on
         // - eos has not been reached
         if (isOn && (bytesRead != -1)) {
-            digest.update(b, off, bytesRead);
+            digest.update(buffer, byteOffset, bytesRead);
         }
         // return number of bytes read
         return bytesRead;

luni/src/main/java/java/util/jar/JarFile.java

         }
 
         @Override
-        public int read(byte[] buf, int off, int nbytes) throws IOException {
+        public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
             if (done) {
                 return -1;
             }
             if (count > 0) {
-                int r = super.read(buf, off, nbytes);
+                int r = super.read(buffer, byteOffset, byteCount);
                 if (r != -1) {
                     int size = r;
                     if (count < size) {
                         size = (int) count;
                     }
-                    entry.write(buf, off, size);
+                    entry.write(buffer, byteOffset, size);
                     count -= size;
                 } else {
                     count = 0;

luni/src/main/java/java/util/jar/JarInputStream.java

     }
 
     /**
-     * Reads up to {@code length} of decompressed data and stores it in
-     * {@code buffer} starting at {@code offset}.
+     * Reads up to {@code byteCount} bytes of decompressed data and stores it in
+     * {@code buffer} starting at {@code byteOffset}. Returns the number of uncompressed bytes read.
      *
-     * @param buffer
-     *            Buffer to store into
-     * @param offset
-     *            offset in buffer to store at
-     * @param length
-     *            number of bytes to store
-     * @return Number of uncompressed bytes read
      * @throws IOException
      *             if an IOException occurs.
      */
     @Override
-    public int read(byte[] buffer, int offset, int length) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         if (mEntry != null) {
             return -1;
         }
-        int r = super.read(buffer, offset, length);
+        int r = super.read(buffer, byteOffset, byteCount);
         if (verStream != null && !eos) {
             if (r == -1) {
                 eos = true;
                     }
                 }
             } else {
-                verStream.write(buffer, offset, r);
+                verStream.write(buffer, byteOffset, r);
             }
         }
         return r;

luni/src/main/java/java/util/zip/CheckedInputStream.java

     }
 
     /**
-     * Reads up to n bytes of data from the underlying input stream, storing it
-     * into {@code buf}, starting at offset {@code off}. The checksum is
+     * Reads up to {@code byteCount} bytes of data from the underlying input stream, storing it
+     * into {@code buffer}, starting at offset {@code byteOffset}. The checksum is
      * updated with the bytes read.
+     * Returns the number of bytes actually read or {@code -1} if arrived at the
+     * end of the filtered stream while reading the data.
      *
-     * @param buf
-     *            the byte array in which to store the bytes read.
-     * @param off
-     *            the initial position in {@code buf} to store the bytes read
-     *            from this stream.
-     * @param nbytes
-     *            the maximum number of bytes to store in {@code buf}.
-     * @return the number of bytes actually read or {@code -1} if arrived at the
-     *         end of the filtered stream while reading the data.
      * @throws IOException
      *             if this stream is closed or some I/O error occurs.
      */
     @Override
-    public int read(byte[] buf, int off, int nbytes) throws IOException {
-        int x = in.read(buf, off, nbytes);
-        if (x != -1) {
-            check.update(buf, off, x);
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+        int bytesRead = in.read(buffer, byteOffset, byteCount);
+        if (bytesRead != -1) {
+            check.update(buffer, byteOffset, bytesRead);
         }
-        return x;
+        return bytesRead;
     }
 
     /**
      * Returns the checksum calculated on the stream read so far.
-     *
-     * @return the updated checksum.
      */
     public Checksum getChecksum() {
         return check;

luni/src/main/java/java/util/zip/DeflaterInputStream.java

     }
 
     /**
-     * Reads compressed data into a byte buffer. The result will be bytes of compressed
+     * Reads up to {@code byteCount} bytes of compressed data into a byte buffer. The result will be bytes of compressed
      * data corresponding to an uncompressed byte or bytes read from the underlying stream.
-     * @return the number of bytes read or -1 if the end of the compressed input
-     *         stream has been reached.
+     * Returns the number of bytes read or -1 if the end of the compressed input
+     * stream has been reached.
      */
-    @Override public int read(byte[] buffer, int offset, int byteCount) throws IOException {
+    @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         checkClosed();
-        Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
         if (byteCount == 0) {
             return 0;
         }
             if (bytesDeflated == -1) {
                 break;
             }
-            System.arraycopy(buf, 0, buffer, offset + count, bytesDeflated);
+            System.arraycopy(buf, 0, buffer, byteOffset + count, bytesDeflated);
             count += bytesDeflated;
         }
         if (count == 0) {

luni/src/main/java/java/util/zip/GZIPInputStream.java

         super.close();
     }
 
-    /**
-     * Reads and decompresses GZIP data from the underlying stream into the
-     * given buffer.
-     */
     @Override
-    public int read(byte[] buffer, int offset, int byteCount) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         if (closed) {
             throw new IOException("Stream is closed");
         }
         if (eos) {
             return -1;
         }
-        Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
 
         int bytesRead;
         try {
-            bytesRead = super.read(buffer, offset, byteCount);
+            bytesRead = super.read(buffer, byteOffset, byteCount);
         } finally {
             eos = eof; // update eos after every read(), even when it throws
         }
 
         if (bytesRead != -1) {
-            crc.update(buffer, offset, bytesRead);
+            crc.update(buffer, byteOffset, bytesRead);
         }
 
         if (eos) {

luni/src/main/java/java/util/zip/InflaterInputStream.java

 
     /**
      * Reads up to {@code byteCount} bytes of decompressed data and stores it in
-     * {@code buffer} starting at {@code offset}.
-     *
-     * @return Number of uncompressed bytes read
+     * {@code buffer} starting at {@code byteOffset}. Returns the number of uncompressed bytes read,
+     * or -1.
      */
     @Override
-    public int read(byte[] buffer, int offset, int byteCount) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         checkClosed();
-        Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
 
         if (byteCount == 0) {
             return 0;
             // Invariant: if reading returns -1 or throws, eof must be true.
             // It may also be true if the next read() should return -1.
             try {
-                int result = inf.inflate(buffer, offset, byteCount);
+                int result = inf.inflate(buffer, byteOffset, byteCount);
                 eof = inf.finished();
                 if (result > 0) {
                     return result;

luni/src/main/java/java/util/zip/ZipFile.java

             return Streams.readSingleByte(this);
         }
 
-        @Override public int read(byte[] b, int off, int len) throws IOException {
+        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
             synchronized (sharedRaf) {
                 sharedRaf.seek(offset);
-                if (len > length - offset) {
-                    len = (int) (length - offset);
+                if (byteCount > length - offset) {
+                    byteCount = (int) (length - offset);
                 }
-                int count = sharedRaf.read(b, off, len);
+                int count = sharedRaf.read(buffer, byteOffset, byteCount);
                 if (count > 0) {
                     offset += count;
                     return count;
             this.entry = entry;
         }
 
-        @Override public int read(byte[] buffer, int off, int nbytes) throws IOException {
-            int i = super.read(buffer, off, nbytes);
+        @Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
+            int i = super.read(buffer, byteOffset, byteCount);
             if (i != -1) {
                 bytesRead += i;
             }

luni/src/main/java/java/util/zip/ZipInputStream.java

     }
 
     /**
-     * Reads up to the specified number of uncompressed bytes into the buffer
-     * starting at the offset.
-     *
-     * @return the number of bytes read
+     * Reads up to {@code byteCount} uncompressed bytes into the buffer
+     * starting at {@code byteOffset}. Returns the number of bytes actually read, or -1.
      */
     @Override
-    public int read(byte[] buffer, int offset, int byteCount) throws IOException {
+    public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException {
         checkClosed();
-        Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
+        Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount);
 
         if (inf.finished() || currentEntry == null) {
             return -1;
             if ((csize - inRead) < toRead) {
                 toRead = csize - inRead;
             }
-            System.arraycopy(buf, lastRead, buffer, offset, toRead);
+            System.arraycopy(buf, lastRead, buffer, byteOffset, toRead);
             lastRead += toRead;
             inRead += toRead;
-            crc.update(buffer, offset, toRead);
+            crc.update(buffer, byteOffset, toRead);
             return toRead;
         }
         if (inf.needsInput()) {
         }
         int read;
         try {
-            read = inf.inflate(buffer, offset, byteCount);
+            read = inf.inflate(buffer, byteOffset, byteCount);
         } catch (DataFormatException e) {
             throw new ZipException(e.getMessage());
         }
         if (read == 0 && inf.finished()) {
             return -1;
         }
-        crc.update(buffer, offset, read);
+        crc.update(buffer, byteOffset, read);
         return read;
     }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.