public static void copy(InputStream in,OutputStream out) throws IOException {
  byte[] buffer=new byte[2048];
  int i;
  while ((i=in.read(buffer)) > 0) {
    out.write(buffer,0,i);
  }
}

public static void copy ( InputStream in , OutputStream out ) throws IOException { byte [ ] buffer = new byte [ 2048 ] ; int i ; while ( ( i = in . read ( buffer ) ) > 0 ) { out . write ( buffer , 0 , i ) ; } }
copy data from one stream to another and do not close i / o .
