63 } |
63 } |
64 return b; |
64 return b; |
65 } |
65 } |
66 |
66 |
67 /** |
67 /** |
68 * Reads into an array of bytes. If <code>len</code> is not zero, the method |
68 * Reads into an array of bytes. If {@code len} is not zero, the method |
69 * blocks until some input is available; otherwise, no |
69 * blocks until some input is available; otherwise, no |
70 * bytes are read and <code>0</code> is returned. |
70 * bytes are read and {@code 0} is returned. |
71 * @param buf the buffer into which the data is read |
71 * @param buf the buffer into which the data is read |
72 * @param off the start offset in the destination array <code>b</code> |
72 * @param off the start offset in the destination array {@code b} |
73 * @param len the maximum number of bytes read |
73 * @param len the maximum number of bytes read |
74 * @return the actual number of bytes read, or -1 if the end |
74 * @return the actual number of bytes read, or -1 if the end |
75 * of the stream is reached. |
75 * of the stream is reached. |
76 * @throws NullPointerException If <code>buf</code> is <code>null</code>. |
76 * @throws NullPointerException If {@code buf} is {@code null}. |
77 * @throws IndexOutOfBoundsException If <code>off</code> is negative, |
77 * @throws IndexOutOfBoundsException If {@code off} is negative, |
78 * <code>len</code> is negative, or <code>len</code> is greater than |
78 * {@code len} is negative, or {@code len} is greater than |
79 * <code>buf.length - off</code> |
79 * {@code buf.length - off} |
80 * @throws IOException if an I/O error has occurred |
80 * @throws IOException if an I/O error has occurred |
81 */ |
81 */ |
82 public int read(byte[] buf, int off, int len) throws IOException { |
82 public int read(byte[] buf, int off, int len) throws IOException { |
83 len = in.read(buf, off, len); |
83 len = in.read(buf, off, len); |
84 if (len != -1) { |
84 if (len != -1) { |