Copying Input Stream to Output Stream

suggest change

This function copies data between two streams -

void copy(InputStream in, OutputStream out) throws IOException {
    byte[] buffer = new byte[8192];
    while ((bytesRead = > 0) {
        out.write(buffer, 0, bytesRead);

Example -

// reading from and writing to System.out
copy(, System.out);

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents