Class PathUtils

java.lang.Object
org.apache.sshd.common.util.io.PathUtils

public final class PathUtils extends Object
  • Field Details

    • BY_CASE_INSENSITIVE_FILENAME

      public static final Comparator<Path> BY_CASE_INSENSITIVE_FILENAME
      Compares 2 Path-s by their case insensitive filename
    • EQ_CASE_INSENSITIVE_FILENAME

      public static final UnaryEquator<Path> EQ_CASE_INSENSITIVE_FILENAME
    • BY_CASE_SENSITIVE_FILENAME

      public static final Comparator<Path> BY_CASE_SENSITIVE_FILENAME
      Compares 2 Path-s by their case sensitive filename
    • EQ_CASE_SENSITIVE_FILENAME

      public static final UnaryEquator<Path> EQ_CASE_SENSITIVE_FILENAME
    • HOME_TILDE_CHAR

      public static final char HOME_TILDE_CHAR
      See Also:
    • USER_HOME_RESOLVER_HOLDER

      private static final AtomicReference<Supplier<? extends Path>> USER_HOME_RESOLVER_HOLDER
  • Constructor Details

    • PathUtils

      private PathUtils()
      Private Constructor
  • Method Details

    • safeCompareFilename

      public static int safeCompareFilename(Path p1, Path p2, boolean caseSensitive)
      Compares 2 Path-s by their filename while allowing for one or both to be null.
      Parameters:
      p1 - 1st Path
      p2 - 2nd Path
      caseSensitive - Whether comparison is case sensitive
      Returns:
      Comparison results - null-s are considered "greater" than non-null-s
    • normalizePath

      public static String normalizePath(String path)
      • Replaces leading '~' with user's HOME directory
      • Replaces any forward slashes with the O/S directory separator
      Parameters:
      path - Input path - ignored if null/empty/blank
      Returns:
      Adjusted path
    • getUserHomeFolder

      public static Path getUserHomeFolder()
      Returns:
      The Path to the currently running user home
      See Also:
    • setUserHomeFolderResolver

      public static void setUserHomeFolderResolver(Supplier<? extends Path> resolver)
      Set the reported value from getUserHomeFolder()
      Parameters:
      resolver - The Path provider to report - if null then "user.home" system property will be used
    • appendUserHome

      public static StringBuilder appendUserHome(StringBuilder sb)
    • appendUserHome

      public static StringBuilder appendUserHome(StringBuilder sb, Path userHome)
    • appendUserHome

      public static StringBuilder appendUserHome(StringBuilder sb, String userHome)