Package io.ocfl.core.path.mapper
Class LogicalPathMappers
java.lang.Object
io.ocfl.core.path.mapper.LogicalPathMappers
This class defines common
LogicalPathMapper
implementations.-
Method Summary
Modifier and TypeMethodDescriptionstatic LogicalPathMapper
Creates a percent-encoding that percent-encodes every character except: [a-zA-Z0-9_-].static LogicalPathMapper
Creates aLogicalPathMapper
that directly maps logical paths to content paths, making no changes.static LogicalPathMapper
Creates a percent-encoding that encodes the following characters that are generally problematic across Windows, linux, and cloud platforms: ASCII characters codes: x0-x1f ASCII characters codes: x7f-xa0 Characters: <>:"\|?* #[]static LogicalPathMapper
Creates a percent-encoding that encodes the following characters that are problematic for some cloud storage platforms: ASCII characters codes: x0-x1f ASCII characters codes: x7f-xa0 Characters: \#[]*?static LogicalPathMapper
Creates a percent-encoding that encodes the following characters: ASCII characters codes: x0-x1f ASCII characters codes: x7f-xa0 Characters:static LogicalPathMapper
Creates a percent-encoding mapper that encodes the following characters that are problematic for Windows: ASCII characters codes: x0-x1f ASCII characters codes: x7f-xa0 Characters: <>:"\|?*
-
Method Details
-
directMapper
Creates aLogicalPathMapper
that directly maps logical paths to content paths, making no changes.- Returns:
- mapper
-
percentEncodingWindowsMapper
Creates a percent-encoding mapper that encodes the following characters that are problematic for Windows:- ASCII characters codes: x0-x1f
- ASCII characters codes: x7f-xa0
- Characters: <>:"\|?*
This should produce generally safe content paths, but they are not guaranteed safe.
- Returns:
- mapper
-
percentEncodingLinuxMapper
Creates a percent-encoding that encodes the following characters:- ASCII characters codes: x0-x1f
- ASCII characters codes: x7f-xa0
- Characters:
Linux is extremely permissive when it comes to the characters that are allowed in filenames. Some of the characters encoded here are in fact legal. However, it is often undesirable for them to appear in filenames.
- Returns:
- mapper
-
percentEncodingCloudMapper
Creates a percent-encoding that encodes the following characters that are problematic for some cloud storage platforms:- ASCII characters codes: x0-x1f
- ASCII characters codes: x7f-xa0
- Characters: \#[]*?
This should produce generally safe content paths, but they are not guaranteed safe.
- Returns:
- mapper
-
percentEncodingAllMapper
Creates a percent-encoding that encodes the following characters that are generally problematic across Windows, linux, and cloud platforms:- ASCII characters codes: x0-x1f
- ASCII characters codes: x7f-xa0
- Characters: <>:"\|?* #[]
This should produce generally safe content paths, but they are not guaranteed safe.
- Returns:
- mapper
-
conservativePercentEncodingMapper
Creates a percent-encoding that percent-encodes every character except: [a-zA-Z0-9_-].This is an extremely conservative mapper that will produce content paths without problematic characters. However, it will also greatly inflate the size of the paths, potentially making them longer than the filesystem's filename size limit.
- Returns:
- mapper
-