Top Inners Fields Constructors Methods
org.apache.sshd.common.util.io

public final Class PathUtils

extends Object
Class Inheritance
Imports
java.io.File, java.nio.file.Path, .Paths, java.util.Comparator, .Objects, java.util.concurrent.atomic.AtomicReference, java.util.function.Supplier, org.apache.sshd.common.util.GenericUtils, .OsUtils, .ValidateUtils, org.apache.sshd.common.util.functors.UnaryEquator

Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final Comparator<Path>
BY_CASE_INSENSITIVE_FILENAME

Compares 2 Path-s by their case insensitive filename

public static final Comparator<Path>
BY_CASE_SENSITIVE_FILENAME

Compares 2 Path-s by their case sensitive filename

public static final UnaryEquator<Path>
public static final UnaryEquator<Path>
public static final char
private static final AtomicReference<Supplier<? extends Path>>

Constructor Summary

AccessConstructor and Description
private
PathUtils()

Private Constructor

Method Summary

Modifier and TypeMethod and Description
public static StringBuilder
public static StringBuilder
public static StringBuilder
public static Path

Returns:

The Path to the currently running user home
getUserHomeFolder
()

public static String

Returns:

Adjusted path
normalizePath
(String
Input path - ignored if null/empty/blank
path
)

  • Replaces leading '~' with user's HOME directory
  • Replaces any forward slashes with the O/S directory separator
public static int

Returns:

Comparison results - null-s are considered "greater" than non-null-s
safeCompareFilename
(Path
1st Path
p1
,
Path
2nd Path
p2
,
boolean
Whether comparison is case sensitive
caseSensitive
)

Compares 2 Path-s by their filename while allowing for one or both to be null.

public static void
setUserHomeFolderResolver(Supplier<? extends Path>
The Path provider to report - if null then "user.home" system property will be used
resolver
)

Set the reported value from getUserHomeFolder()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BY_CASE_INSENSITIVE_FILENAMEback to summary
public static final Comparator<Path> BY_CASE_INSENSITIVE_FILENAME

Compares 2 Path-s by their case insensitive filename

BY_CASE_SENSITIVE_FILENAMEback to summary
public static final Comparator<Path> BY_CASE_SENSITIVE_FILENAME

Compares 2 Path-s by their case sensitive filename

EQ_CASE_INSENSITIVE_FILENAMEback to summary
public static final UnaryEquator<Path> EQ_CASE_INSENSITIVE_FILENAME
EQ_CASE_SENSITIVE_FILENAMEback to summary
public static final UnaryEquator<Path> EQ_CASE_SENSITIVE_FILENAME
HOME_TILDE_CHARback to summary
public static final char HOME_TILDE_CHAR
USER_HOME_RESOLVER_HOLDERback to summary
private static final AtomicReference<Supplier<? extends Path>> USER_HOME_RESOLVER_HOLDER

Constructor Detail

PathUtilsback to summary
private PathUtils()

Private Constructor

Method Detail

appendUserHomeback to summary
public static StringBuilder appendUserHome(StringBuilder sb)
appendUserHomeback to summary
public static StringBuilder appendUserHome(StringBuilder sb, Path userHome)
appendUserHomeback to summary
public static StringBuilder appendUserHome(StringBuilder sb, String userHome)
getUserHomeFolderback to summary
public static Path getUserHomeFolder()
Returns:Path

The Path to the currently running user home

Annotations
@SuppressWarnings:synthetic-access
See Also
setUserHomeFolderResolver(Supplier)
normalizePathback to summary
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:String

Input path - ignored if null/empty/blank

Returns:String

Adjusted path

safeCompareFilenameback to summary
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:Path

1st Path

p2:Path

2nd Path

caseSensitive:boolean

Whether comparison is case sensitive

Returns:int

Comparison results - null-s are considered "greater" than non-null-s

setUserHomeFolderResolverback to summary
public static void setUserHomeFolderResolver(Supplier<? extends Path> resolver)

Set the reported value from getUserHomeFolder()

Parameters
resolver:Supplier<? extends Path>

The Path provider to report - if null then "user.home" system property will be used

org.apache.sshd.common.util.io back to summary

private final Class PathUtils.LazyDefaultUserHomeFolderHolder

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.sshd.common.util.io.PathUtils.LazyDefaultUserHomeFolderHolder

Field Summary

Modifier and TypeField and Description
private static final Path

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

PATHback to summary
private static final Path PATH

Constructor Detail

LazyDefaultUserHomeFolderHolderback to summary
private LazyDefaultUserHomeFolderHolder()