public static void transfer(InputStream in, OutputStream out) throws IOException
    {
        byte[] bytes = new byte[TRANSFER_BUFFER];
        int count;
        while ((count = in.read(bytes)) != -1)
        {
            out.write(bytes, 0, count);
        }
    }
public static void transfer ( InputStream in , OutputStream out ) throws IOException { byte [ ] bytes = new byte [ TRANSFER_BUFFER ] ; int count ; while ( ( count = in . read ( bytes ) ) != - 1 ) { out . write ( bytes , 0 , count ) ; } }
Transfers bytes from an input stream to an output stream.
Callers of this method are responsible for closing the streams
since they are the ones that opened the streams.