Package org.ametys.core.util
Class FilenameUtils
java.lang.Object
org.ametys.core.util.FilenameUtils
Utility class for encoding file names and paths.
These methods are used to provide safe names to be stored on disk.
The encode* methods %-encode all reserved chars, plus the '%' char itself.
The filter* methods replace reserved chars with the '_' char.
Reserved chars are
These methods are used to provide safe names to be stored on disk.
The encode* methods %-encode all reserved chars, plus the '%' char itself.
The filter* methods replace reserved chars with the '_' char.
Reserved chars are
\ / ? : * | " < >
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
Character used to replace reserved chars in the filter* methods. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Decodes an URI-encoded String.static String
encodeName
(String name) %-encode a file name to be stored on disk.static String
encodePath
(String path) %-encode a file path to be stored on disk.static String
filterName
(String name) Replace reserved characters from a file name with a _.static String
filterPath
(String path) Replace reserved characters from a file path with a _.
-
Field Details
-
REPLACEMENT_CHAR
Character used to replace reserved chars in the filter* methods.- See Also:
-
-
Method Details
-
encodePath
%-encode a file path to be stored on disk.- Parameters:
path
- the file path to encode- Returns:
- the encoded file path.
-
encodeName
%-encode a file name to be stored on disk.- Parameters:
name
- the file name to encode- Returns:
- the encoded file name.
-
filterPath
Replace reserved characters from a file path with a _.- Parameters:
path
- the file path to transform- Returns:
- the filtered file path
-
filterName
Replace reserved characters from a file name with a _.- Parameters:
name
- the file name to transform- Returns:
- the filtered file name
-
decode
Decodes an URI-encoded String.- Parameters:
source
- the String to decode.- Returns:
- the decoded String.
-