code: private static String formatPathToFile(Path path) {
      return StringUtils.removeEnd(path.toString(), Path.SEPARATOR);
    }
docs: Convert a {@link Path} to a {@link String} and make sure it is properly formatted to be recognized as a file
  by {@link TarArchiveEntry}.