public class SimpleFileDownloader extends Object implements FileDownloader
| Constructor and Description |
|---|
SimpleFileDownloader() |
| Modifier and Type | Method and Description |
|---|---|
protected java.nio.file.Path |
copyLocalFile(URL fileUrl)
Efficient copy of file in case of local file system
|
java.nio.file.Path |
downloadFile(URL fileUrl)
Downloads a file.
|
protected java.nio.file.Path |
downloadFileHttp(URL fileUrl)
Downloads file from HTTP or FTP
|
protected void |
validateDownload(URL originalUrl,
java.nio.file.Path downloadedFile)
Succeeds if downloaded file exists and has size > 0
|
public java.nio.file.Path downloadFile(URL fileUrl) throws ro.fortsoft.pf4j.PluginException, IOException
downloadFile in interface FileDownloaderfileUrl - the URI representing the file to downloadIOException - in case of network or IO problemsro.fortsoft.pf4j.PluginException - in case of other problemsprotected java.nio.file.Path copyLocalFile(URL fileUrl) throws IOException, ro.fortsoft.pf4j.PluginException
fileUrl - source fileIOException - if problems during copyro.fortsoft.pf4j.PluginException - in case of other problemsprotected java.nio.file.Path downloadFileHttp(URL fileUrl) throws IOException, ro.fortsoft.pf4j.PluginException
fileUrl - source fileIOException - if IO problemsro.fortsoft.pf4j.PluginException - if validation fails or any other problemsprotected void validateDownload(URL originalUrl, java.nio.file.Path downloadedFile) throws ro.fortsoft.pf4j.PluginException
Override this method to provide your own validation rules such as content length matching or checksum checking etc
originalUrl - the source from which the file was downloadeddownloadedFile - the path to the downloaded filero.fortsoft.pf4j.PluginException - if the validation failedCopyright © 2017. All Rights Reserved.