Class PathRedactor
<run> and the user's home folder with ~. Every other path is left as
it is.
Each folder is hidden in the form it was given, in its absolute normalized form and, when it
exists, in its real form with links resolved (on macOS, /tmp/run is also
/private/tmp/run). The forms of all folders are replaced longest first, so a folder
inside another is replaced by its own name: with the run folder inside the home folder, a path
under the run folder reads <run>/… rather than ~/….
A folder is matched as a whole path: hiding /home/ann leaves /home/anna,
/data/home/ann and /home/ann.bak alone, and hides it in /home/ann/x,
file:/home/ann and "/home/ann". A root is never hidden, since it would hide far
more than the folder, and a relative folder is hidden only in its absolute and real forms,
resolved against the working directory. A letter or digit of any script next to a form makes it
a longer name, so /home/annä is left alone too.
A form is matched exactly as the platform writes it: a path written with another case, percent-encoded, with doubled separators or in another platform's form is not hidden. The redactor hides the folders it is given; it is not a filter for every secret a text may hold.
The redactor is immutable and may be used from several threads at once.
- Since:
- 0.18.6
-
Constructor Details
-
PathRedactor
Creates a redactor for the given folders.- Parameters:
replacements- each folder to hide and what replaces it; anullfolder is skipped, and the map's order does not matter- Throws:
NullPointerException- ifreplacementsisnull, or a folder's replacement isnull
-
-
Method Details