private static void copy(final InputStream input,final File output) throws IOException {
  final byte[] buffer=new byte[BUFFER_SIZE];
  final FileOutputStream stream=new FileOutputStream(output);
  try {
    int read;
    while ((read=input.read(buffer)) != -1) {
      stream.write(buffer,0,read);
    }
  }
  finally {
    stream.close();
  }
}

private static void copy ( final InputStream input , final File output ) throws IOException { final byte [ ] buffer = new byte [ BUFFER_SIZE ] ; final FileOutputStream stream = new FileOutputStream ( output ) ; try { int read ; while ( ( read = input . read ( buffer ) ) != - 1 ) { stream . write ( buffer , 0 , read ) ; } } finally { stream . close ( ) ; } }
copies the specified input stream to the specified output file .
