public static void writeStream(InputStream in,File file) throws IOException {
  FileOutputStream out=new FileOutputStream(file);
  try {
    transfer(in,out);
  }
  finally {
    try {
      out.flush();
    }
  finally {
      out.close();
    }
  }
}

public static void writeStream ( InputStream in , File file ) throws IOException { FileOutputStream out = new FileOutputStream ( file ) ; try { transfer ( in , out ) ; } finally { try { out . flush ( ) ; } finally { out . close ( ) ; } } }
writes all data that can be read from the supplied inputstream to the specified file .
