JAL-3365 per-sequence secondary structure symbol ‘X’ is not properly exported and...
[jalview.git] / src / jalview / ws / utils / UrlDownloadClient.java
index e42c21e..e2fb1b8 100644 (file)
@@ -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;
@@ -101,5 +105,15 @@ public class UrlDownloadClient
                 + e.getMessage());
       }
     }
+
+  }
+
+  public static void download(String urlstring, File tempFile)
+          throws IOException
+  {
+    if (!Platform.setFileBytes(tempFile, urlstring))
+    {
+      download(urlstring, tempFile.toString());
+    }
   }
 }