git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3438 spotless for 2.11.2.0
[jalview.git]
/
src
/
jalview
/
ws
/
utils
/
UrlDownloadClient.java
diff --git
a/src/jalview/ws/utils/UrlDownloadClient.java
b/src/jalview/ws/utils/UrlDownloadClient.java
index
448edd9
..
e2fb1b8
100644
(file)
--- a/
src/jalview/ws/utils/UrlDownloadClient.java
+++ b/
src/jalview/ws/utils/UrlDownloadClient.java
@@
-21,6
+21,9
@@
package jalview.ws.utils;
package jalview.ws.utils;
+import jalview.util.Platform;
+
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
@@
-33,11
+36,6
@@
import java.nio.file.StandardCopyOption;
public class UrlDownloadClient
{
public class UrlDownloadClient
{
- public UrlDownloadClient()
- {
-
- }
-
/**
* Download and save a file from a URL
*
/**
* Download and save a file from a URL
*
@@
-50,6
+48,7
@@
public class UrlDownloadClient
public static void download(String urlstring, String outfile)
throws IOException
{
public static void download(String urlstring, String outfile)
throws IOException
{
+
FileOutputStream fos = null;
ReadableByteChannel rbc = null;
Path temp = null;
FileOutputStream fos = null;
ReadableByteChannel rbc = null;
Path temp = null;
@@
-106,5
+105,15
@@
public class UrlDownloadClient
+ e.getMessage());
}
}
+ e.getMessage());
}
}
+
+ }
+
+ public static void download(String urlstring, File tempFile)
+ throws IOException
+ {
+ if (!Platform.setFileBytes(tempFile, urlstring))
+ {
+ download(urlstring, tempFile.toString());
+ }
}
}
}
}