Copy the contents of the specified input stream to the specified output stream, and ensure that the input stream is closed before returning (even in the face of an exception). @param is The input stream to read the source resource from @param ostream The output stream to write to @exception I
(InputStream is, ServletOutputStream ostream)
| 2574 | * @exception IOException if an input/output error occurs |
| 2575 | */ |
| 2576 | protected void copy(InputStream is, ServletOutputStream ostream) throws IOException { |
| 2577 | |
| 2578 | InputStream istream = new BufferedInputStream(is, input); |
| 2579 | |
| 2580 | // Copy the input stream to the output stream |
| 2581 | IOException exception = copyNoThrow(istream, ostream); |
| 2582 | |
| 2583 | // Clean up the input stream |
| 2584 | istream.close(); |
| 2585 | |
| 2586 | // Rethrow any exception that has occurred |
| 2587 | if (exception != null) { |
| 2588 | throw exception; |
| 2589 | } |
| 2590 | } |
| 2591 | |
| 2592 | |
| 2593 | /** |
no test coverage detected