package org.opencb.opencga.analysis;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

public class ResourceUtils {

    public static void download(URL url, Path outDir) throws IOException {
        InputStream in = url.openStream();
        Files.copy(in, outDir.resolve(new File(url.getFile()).getName()), StandardCopyOption.REPLACE_EXISTING);
    }

    public static void download(URL url, File outFile) throws IOException {
        InputStream in = url.openStream();
        Files.copy(in, outFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
    }
}

@@ -266,36 +266,36 @@
   public static 
-void
+File
  download(URL ur
@@ -343,64 +343,27 @@
     
-InputStream in = url.openStream();%0A        Files.copy(in
+return download(url
 , ou
@@ -413,45 +413,17 @@
 e())
-, StandardCopyOption.REPLACE_EXISTING
+.toFile()
 );%0A 
@@ -450,12 +450,12 @@
 tic 
-void
+File
  dow
@@ -626,16 +626,107 @@
 STING);%0A
+        if (outFile.exists()) %7B%0A            return outFile;%0A        %7D%0A        return null;%0A
     %7D%0A%7D%0A

return the file after downloading, #1508