code: protected Path copyLocalFile(URL fileUrl) throws IOException, PluginException {
          Path destination = Files.createTempDirectory("pf4j-update-downloader");
          destination.toFile().deleteOnExit();
  
          try {
              Path fromFile = Paths.get(fileUrl.toURI());
              String path = fileUrl.getPath();
              String fileName = path.substring(path.lastIndexOf('/') + 1);
              Path toFile = destination.resolve(fileName);
              Files.copy(fromFile, toFile, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
  
              return toFile;
          } catch (URISyntaxException e) {
              throw new PluginException("Something wrong with given URL", e);
          }
      }
docs: Efficient copy of file in case of local file system.
  
  @param fileUrl source file
  @return path of target file
  @throws IOException if problems during copy
  @throws PluginException in case of other problems