public static void copy(InputStream in,OutputStream out) throws IOException {
  byte[] buf=new byte[8 * 1024];
  int read=0;
  while ((read=in.read(buf)) > -1) {
    out.write(buf,0,read);
  }
}

public static void copy ( InputStream in , OutputStream out ) throws IOException { byte [ ] buf = new byte [ 8 * 1024 ] ; int read = 0 ; while ( ( read = in . read ( buf ) ) > - 1 ) { out . write ( buf , 0 , read ) ; } }
copies the given inputstream to the given outputstream .
