package jalview.ws.utils;
+import jalview.util.Platform;
+
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
public static void download(String urlstring, String outfile)
throws IOException
{
+
FileOutputStream fos = null;
ReadableByteChannel rbc = null;
Path temp = null;
}
} catch (IOException e)
{
- System.out.println(
+ jalview.bin.Console.outPrintln(
"Exception while closing download file output stream: "
+ e.getMessage());
}
}
} 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
{
}
} 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());
+ }
}
}