X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Futils%2FUrlDownloadClient.java;h=91d88c2ab1b10c6310b73ae98fd1fc0b1b69339f;hb=0ebbad305e982eeda562a1842362dc415c36cc8d;hp=e42c21e31b9a08b50f7a08f892479c7f4fbb7d3d;hpb=70c875f4c2db626298097acd47f31db9115fcea8;p=jalview.git diff --git a/src/jalview/ws/utils/UrlDownloadClient.java b/src/jalview/ws/utils/UrlDownloadClient.java index e42c21e..91d88c2 100644 --- a/src/jalview/ws/utils/UrlDownloadClient.java +++ b/src/jalview/ws/utils/UrlDownloadClient.java @@ -21,6 +21,9 @@ package jalview.ws.utils; +import jalview.util.Platform; + +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; @@ -45,6 +48,7 @@ public class UrlDownloadClient public static void download(String urlstring, String outfile) throws IOException { + FileOutputStream fos = null; ReadableByteChannel rbc = null; Path temp = null; @@ -74,7 +78,7 @@ public class UrlDownloadClient } } catch (IOException e) { - System.out.println( + jalview.bin.Console.outPrintln( "Exception while closing download file output stream: " + e.getMessage()); } @@ -86,8 +90,9 @@ public class UrlDownloadClient } } catch (IOException e) { - System.out.println("Exception while closing download channel: " - + e.getMessage()); + jalview.bin.Console + .outPrintln("Exception while closing download channel: " + + e.getMessage()); } try { @@ -97,9 +102,20 @@ public class UrlDownloadClient } } catch (IOException e) { - System.out.println("Exception while deleting download temp file: " - + e.getMessage()); + jalview.bin.Console + .outPrintln("Exception while deleting download temp file: " + + e.getMessage()); } } + + } + + public static void download(String urlstring, File tempFile) + throws IOException + { + if (!Platform.setFileBytes(tempFile, urlstring)) + { + download(urlstring, tempFile.toString()); + } } }