Package org.apache.sshd.common.util.io
Class PathUtils
- java.lang.Object
-
- org.apache.sshd.common.util.io.PathUtils
-
public final class PathUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPathUtils.LazyDefaultUserHomeFolderHolder
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<java.nio.file.Path>BY_CASE_INSENSITIVE_FILENAMECompares 2Path-s by their case insensitivefilenamestatic java.util.Comparator<java.nio.file.Path>BY_CASE_SENSITIVE_FILENAMECompares 2Path-s by their case sensitivefilenamestatic UnaryEquator<java.nio.file.Path>EQ_CASE_INSENSITIVE_FILENAMEstatic UnaryEquator<java.nio.file.Path>EQ_CASE_SENSITIVE_FILENAMEstatic charHOME_TILDE_CHAR
-
Constructor Summary
Constructors Modifier Constructor Description privatePathUtils()Private Constructor
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringBuilderappendUserHome(java.lang.StringBuilder sb)static java.lang.StringBuilderappendUserHome(java.lang.StringBuilder sb, java.lang.String userHome)static java.lang.StringBuilderappendUserHome(java.lang.StringBuilder sb, java.nio.file.Path userHome)static java.nio.file.PathgetUserHomeFolder()static java.lang.StringnormalizePath(java.lang.String path)Replaces leading '~' with user's HOME directory Replaces any forward slashes with the O/S directory separatorstatic intsafeCompareFilename(java.nio.file.Path p1, java.nio.file.Path p2, boolean caseSensitive)Compares 2Path-s by theirfilenamewhile allowing for one or both to benull.
-
-
-
Field Detail
-
BY_CASE_INSENSITIVE_FILENAME
public static final java.util.Comparator<java.nio.file.Path> BY_CASE_INSENSITIVE_FILENAME
Compares 2Path-s by their case insensitivefilename
-
EQ_CASE_INSENSITIVE_FILENAME
public static final UnaryEquator<java.nio.file.Path> EQ_CASE_INSENSITIVE_FILENAME
-
BY_CASE_SENSITIVE_FILENAME
public static final java.util.Comparator<java.nio.file.Path> BY_CASE_SENSITIVE_FILENAME
Compares 2Path-s by their case sensitivefilename
-
EQ_CASE_SENSITIVE_FILENAME
public static final UnaryEquator<java.nio.file.Path> EQ_CASE_SENSITIVE_FILENAME
-
HOME_TILDE_CHAR
public static final char HOME_TILDE_CHAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
safeCompareFilename
public static int safeCompareFilename(java.nio.file.Path p1, java.nio.file.Path p2, boolean caseSensitive)Compares 2Path-s by theirfilenamewhile allowing for one or both to benull.- Parameters:
p1- 1stPathp2- 2ndPathcaseSensitive- Whether comparison is case sensitive- Returns:
- Comparison results -
null-s are considered "greater" than non-null-s
-
normalizePath
public static java.lang.String normalizePath(java.lang.String path)
- Replaces leading '~' with user's HOME directory
- Replaces any forward slashes with the O/S directory separator
- Parameters:
path- Input path - ignored ifnull/empty/blank- Returns:
- Adjusted path
-
getUserHomeFolder
public static java.nio.file.Path getUserHomeFolder()
- Returns:
- The
Pathto the currently running user home
-
appendUserHome
public static java.lang.StringBuilder appendUserHome(java.lang.StringBuilder sb)
-
appendUserHome
public static java.lang.StringBuilder appendUserHome(java.lang.StringBuilder sb, java.nio.file.Path userHome)
-
appendUserHome
public static java.lang.StringBuilder appendUserHome(java.lang.StringBuilder sb, java.lang.String userHome)
-
-