equal
deleted
inserted
replaced
393 * @exception IOException if this input stream has been closed by |
393 * @exception IOException if this input stream has been closed by |
394 * invoking its {@link #close()} method, |
394 * invoking its {@link #close()} method, |
395 * or an I/O error occurs. |
395 * or an I/O error occurs. |
396 */ |
396 */ |
397 public synchronized int available() throws IOException { |
397 public synchronized int available() throws IOException { |
398 return getInIfOpen().available() + (count - pos); |
398 int n = count - pos; |
|
399 int avail = getInIfOpen().available(); |
|
400 return n > (Integer.MAX_VALUE - avail) |
|
401 ? Integer.MAX_VALUE |
|
402 : n + avail; |
399 } |
403 } |
400 |
404 |
401 /** |
405 /** |
402 * See the general contract of the <code>mark</code> |
406 * See the general contract of the <code>mark</code> |
403 * method of <code>InputStream</code>. |
407 * method of <code>InputStream</code>. |