From e9e6eb2b676d8ce0767f38f66d63ab25ea57f297 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Fri, 8 Nov 2013 19:33:19 +0400 Subject: [PATCH] 'Download library' refactored a little --- .../platform/templates/github/DownloadUtil.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java b/platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java index 205df47a335a..14c6674d8153 100644 --- a/platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java +++ b/platform/lang-impl/src/com/intellij/platform/templates/github/DownloadUtil.java @@ -69,6 +69,22 @@ public class DownloadUtil { } } + /** + * Downloads content of {@code url} to {@code outputFile} atomically. + * {@code outputFile} won't be modified in case of any I/O download errors. + * + * @param indicator progress indicator + * @param url url to download + * @param outputFile output file + */ + public static void downloadAtomically(@Nullable ProgressIndicator indicator, + @NotNull String url, + @NotNull File outputFile) throws IOException + { + File tempFile = FileUtil.createTempFile("for-actual-downloading-", null); + downloadAtomically(indicator, url, outputFile, tempFile, null); + } + /** * Downloads content of {@code url} to {@code outputFile} atomically. * {@code outputFile} won't be modified in case of any I/O download errors.