Transfers the length of the buffer amount of data from the input stream to the output stream @param in the input @param out the output @param buffer the buffer and size to use @return the actual transfered amount @throws IOException shit happens
(InputStream in, OutputStream out, byte[] buffer)
| 144 | * @throws IOException shit happens |
| 145 | */ |
| 146 | public static int transfer(InputStream in, OutputStream out, byte[] buffer) throws IOException { |
| 147 | int r = in.read(buffer); |
| 148 | |
| 149 | if (r != -1) { |
| 150 | out.write(buffer, 0, r); |
| 151 | } |
| 152 | |
| 153 | return r; |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Transfers the length of the buffer amount of data from the input stream to |