Class LogicalPathMappers
- java.lang.Object
-
- edu.wisc.library.ocfl.core.path.mapper.LogicalPathMappers
-
public final class LogicalPathMappers extends Object
This class defines commonLogicalPathMapperimplementations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LogicalPathMapperconservativePercentEncodingMapper()Creates a percent-encoding that percent-encodes every character except: [a-zA-Z0-9_-].static LogicalPathMapperdirectMapper()Creates aLogicalPathMapperthat directly maps logical paths to content paths, making no changes.static LogicalPathMapperpercentEncodingAllMapper()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 LogicalPathMapperpercentEncodingCloudMapper()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 LogicalPathMapperpercentEncodingLinuxMapper()Creates a percent-encoding that encodes the following characters: ASCII characters codes: x0-x1f ASCII characters codes: x7f-xa0 Characters:static LogicalPathMapperpercentEncodingWindowsMapper()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 Detail
-
directMapper
public static LogicalPathMapper directMapper()
Creates aLogicalPathMapperthat directly maps logical paths to content paths, making no changes.- Returns:
- mapper
-
percentEncodingWindowsMapper
public static LogicalPathMapper 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
public static LogicalPathMapper 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
public static LogicalPathMapper 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
public static LogicalPathMapper 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
public static LogicalPathMapper 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
-
-