Class PathUtil
This utility provides methods to transform both Path objects and String representations of file paths into a format where file separators are replaced with dots. This is useful for creating consistent, human-readable identifiers from file paths.
-
Constructor Details
-
PathUtil
public PathUtil()
-
-
Method Details
-
convertPathToDottedString
Converts a Path object into a dotted string representation.This method replaces the default file separator characters in the path with dots, effectively converting the hierarchical file path structure into a single, dot-separated string. If the resulting string ends with a dot, that trailing character is removed.
- Parameters:
path- The Path object to be converted.- Returns:
- A string representation of the path where separators are replaced by dots.
- Throws:
MalformedParametersException- If an error occurs during conversion.
-
convertPathToDottedString
Converts a String representation of a path into a dotted string.This method replaces the default file separator characters in the string with dots, creating a consistent, dot-separated format for file paths. It also removes any trailing period from the resulting string. This can be useful when working with file path strings that need to be processed or displayed in a more readable way.
- Parameters:
path- The String representation of the path to be converted.- Returns:
- A string where all file separators have been replaced by dots, with any trailing period removed.
- Throws:
GeneralSecurityException- If an error occurs during conversion.
-