Package io.ocfl.core.path.constraint
Class BitSetPathCharConstraint
java.lang.Object
io.ocfl.core.path.constraint.BitSetPathCharConstraint
- All Implemented Interfaces:
PathCharConstraint
Constraint that applies restrictions on what characters are allowed in file names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BitSetPathCharConstraint
acceptList
(char... chars) Creates a constraint that only accepts the specified charactersstatic BitSetPathCharConstraint
acceptListRange
(char start, char end) Creates a constraint that accepts all of the characters in the given rangevoid
Validates that the characters in a filename meet a defined constraintstatic BitSetPathCharConstraint
blockList
(char... chars) Creates a constraint that rejects the specified charactersstatic BitSetPathCharConstraint
blockListRange
(char start, char end) Creates a constraint that rejects all of the characters in the given range
-
Constructor Details
-
BitSetPathCharConstraint
-
-
Method Details
-
blockList
Creates a constraint that rejects the specified characters- Parameters:
chars
- the characters to reject- Returns:
- constraint
-
blockListRange
Creates a constraint that rejects all of the characters in the given range- Parameters:
start
- beginning of range, inclusiveend
- end of range, inclusive- Returns:
- constraint
-
acceptList
Creates a constraint that only accepts the specified characters- Parameters:
chars
- the characters to accept- Returns:
- constraint
-
acceptListRange
Creates a constraint that accepts all of the characters in the given range- Parameters:
start
- beginning of range, inclusiveend
- end of range, inclusive- Returns:
- constraint
-
apply
Validates that the characters in a filename meet a defined constraint- Specified by:
apply
in interfacePathCharConstraint
- Parameters:
c
- the character to validatepath
- the path the character is part of. This is supplied for context and is not validated
-