public Path downloadFile(URL fileUrl) throws PluginException, IOException {
        switch (fileUrl.getProtocol()) {
            case "http":
            case "https":
            case "ftp":
                return downloadFileHttp(fileUrl);
            case "file":
                return copyLocalFile(fileUrl);
            default:
                throw new PluginException("URL protocol {} not supported", fileUrl.getProtocol());
        }
    }
public Path downloadFile ( URL fileUrl ) throws PluginException , IOException { switch ( fileUrl . getProtocol ( ) ) { case "http" : case "https" : case "ftp" : return downloadFileHttp ( fileUrl ) ; case "file" : return copyLocalFile ( fileUrl ) ; default : throw new PluginException ( "URL protocol {} not supported" , fileUrl . getProtocol ( ) ) ; } }
Downloads a file. If HTTP(S) or FTP, stream content, if local file:/ do a simple filesystem copy to tmp folder.
Other protocols not supported.

@param fileUrl the URI representing the file to download
@return the path of downloaded/copied file
@throws IOException in case of network or IO problems
@throws PluginException in case of other problems