Copies bytes from an InputStream to an OutputStream . This method buffers the input internally, so there is no need to use a BufferedInputStream . Large streams (over 2GB) will return a bytes copied value of -1 after the copy has completed si
(final InputStream input, final OutputStream output)
| 2075 | * @since 1.1 |
| 2076 | */ |
| 2077 | public static int copy(final InputStream input, final OutputStream output) throws IOException { |
| 2078 | final long count = copyLarge(input, output); |
| 2079 | if (count > Integer.MAX_VALUE) { |
| 2080 | return -1; |
| 2081 | } |
| 2082 | return (int) count; |
| 2083 | } |
| 2084 | |
| 2085 | /** |
| 2086 | * Copies bytes from an <code>InputStream</code> to an <code>OutputStream</code> using an internal buffer of the |