public abstract int read (byte[] b, int off, int len) throws IOException

Reads up to len bytes from the stream, and stores them into b starting at index off. The number of bytes read is returned. If no bytes can be read because the end of the stream has been reached, -1 is returned.

The bit offset within the stream is reset to zero before the read occurs.

Parameters:
b    an array of bytes to be written to.
off    the starting position within b to write to.
len    the maximum number of bytes to read.

Returns:  the number of bytes actually read, or -1 to indicate EOF.

Exceptions:
NullPointerException    if b is null.
IndexOutOfBoundsException    if off is negative, len is negative, or off + len is greater than b.length.
IOException    if an I/O error occurs.