Class PathUtils

java.lang.Object
io.pebbletemplates.pebble.utils.PathUtils

public final class PathUtils extends Object
Utility class to handle relative paths.
  • Field Details

    • PATH_SEPARATOR_REGEX

      public static final Pattern PATH_SEPARATOR_REGEX
  • Constructor Details

    • PathUtils

      private PathUtils()
  • Method Details

    • resolveRelativePath

      public static String resolveRelativePath(String relativePath, String anchorPath, char expectedSeparator)
      Resolves the given relativePath based on the given anchorPath.
      Parameters:
      relativePath - the relative path which should be resolved.
      anchorPath - the anchor path based on which the relative path should be resolved on.
      expectedSeparator - The character expected to be used as a separator; dictated by the Loader.
      Returns:
      the resolved path or null when the path could not be resolved.
    • sanitize

      private static String sanitize(String path, char expectedSeparator)
    • resolvePathInner

      private static String resolvePathInner(String relativePath, String anchorPath, char separator)
    • determineAnchorPathSegments

      private static Collection<String> determineAnchorPathSegments(String anchorPath, char separator)
    • resolvePathSegments

      private static Collection<String> resolvePathSegments(Collection<String> anchorSegments, Collection<String> relativeSegments)
    • splitBySeparator

      private static List<String> splitBySeparator(String path, char separator)