public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException {
        byte buffer[] = new byte[1024 * 100]; // 100kb
        int len = -1;
        int total = 0;

        while ((len = is.read(buffer)) >= 0) {
            os.write(buffer, 0, len);
            total += len;
        }
        return total;
    }
public int inputStreamToOutputStream ( InputStream is , OutputStream os ) throws IOException { byte buffer [ ] = new byte [ 1024 * 100 ] ; int len = - 1 ; int total = 0 ; while ( ( len = is . read ( buffer ) ) >= 0 ) { os . write ( buffer , 0 , len ) ; total += len ; } return total ; }
Write to the outputstream the bytes read from the input stream.