コード例 #1
0
 private void updateFiles() {
   Logger.logInfo("[i18n] Downloading locale files ...");
   try {
     DownloadUtils.downloadToFile(
         new URL(DownloadUtils.getCreeperhostLink("locales.zip")), archive);
     Logger.logInfo("[i18n] Moving files into place ...");
     if (local.getParentFile().exists()) {
       FileUtils.delete(local.getParentFile());
     }
     FileUtils.extractZipTo(archive.getAbsolutePath(), local.getParentFile().getPath());
     if (!local.exists()) {
       local.createNewFile();
     }
     Writer wr = new FileWriter(local);
     wr.write(String.valueOf(remoteVer));
     wr.close();
     cleanUpFiles();
   } catch (Exception e) {
     Logger.logWarn("[i18n] Update IOException", e);
   }
 }
コード例 #2
0
ファイル: DownloadUtils.java プロジェクト: blued00r/FTBLaunch
 /**
  * Downloads data from the given URL and saves it to the given file
  *
  * @param filename - String of destination
  * @param urlString - http location of file to download
  */
 public static void downloadToFile(String filename, String urlString) throws IOException {
   downloadToFile(new URL(urlString), new File(filename));
 }