code: public File resolveResource(String resourceLocation,
              String downloadLocation) throws ResourceDownloadError {
          int indexOf = resourceLocation.indexOf(':');
          if (indexOf == -1) {
              final String url = downloadLocation;
              final String msg = "Unknown protocol";
              throw new ResourceDownloadError(url, msg);
          }
  
          String protocol = resourceLocation.substring(0, indexOf);
          SupportedProtocol supportedProtocol =
                  SupportedProtocol.getByProtocolScheme(protocol);
  
          if (supportedProtocol == null) {
              final String url = downloadLocation;
              final String msg = "No protocol for " + protocol;
              throw new ResourceDownloadError(url, msg);
          }
  
          ProtocolHandler protocolHandler = null;
          switch (supportedProtocol) {
          case FILE:
              protocolHandler = new FileProtocolHandler();
              break;
          case HTTP:
              protocolHandler = new HttpProtocolHandler();
              break;
          case HTTPS:
              protocolHandler = new HttpsProtocolHandler();
              break;
          case SFTP:
              protocolHandler = new SftpProtocolHandler();
              break;
          case FTP:
              protocolHandler = new FTPProtocolHandler();
              break;
          default:
              final String url = downloadLocation;
              final String msg = "No case for " + supportedProtocol;
              throw new ResourceDownloadError(url, msg);
          }
  
          return protocolHandler.downloadResource(resourceLocation,
                  downloadLocation);
      }
docs: Retrieves a resource from the {@code resourceLocation} and saves
  it to {@code downloadLocation}.
  
  @param resourceLocation {@link String}, the resource location url
  @param downloadLocation {@link String}, the download location path
  @return {@link File}, the local downloaded resource file
  @throws ResourceDownloadError Thrown if an error occurred
  downloading the resource