Class FileDownloader
java.lang.Object
uk.ac.manchester.spinnaker.nmpiexec.utils.FileDownloader
public abstract class FileDownloader extends Object
Utilities for downloading a file.
-
Method Summary
Modifier and Type Method Description static File
downloadFile(String url, File workingDirectory, String defaultFilename)
Downloads a file from a URL.static File
downloadFile(URL url, File workingDirectory, String defaultFilename)
Downloads a file from a URL.
-
Method Details
-
downloadFile
public static File downloadFile(URL url, File workingDirectory, String defaultFilename) throws IOExceptionDownloads a file from a URL.- Parameters:
url
- The URL to download the file fromworkingDirectory
- The directory to output the file todefaultFilename
- The name of the file to use if none can be worked out from the URL or headers, ornull
to use a generated name- Returns:
- The file downloaded
- Throws:
IOException
- If anything goes wrong.
-
downloadFile
public static File downloadFile(String url, File workingDirectory, String defaultFilename) throws IOExceptionDownloads a file from a URL.- Parameters:
url
- The URL to download the file fromworkingDirectory
- The directory to output the file todefaultFilename
- The name of the file to use if none can be worked out from the URL or headers, ornull
to use a generated name- Returns:
- The file downloaded
- Throws:
IOException
- If anything goes wrong.
-