Package io.ocfl.core.path.constraint
Class PathLengthConstraint
java.lang.Object
io.ocfl.core.path.constraint.PathLengthConstraint
- All Implemented Interfaces:
FileNameConstraint
,PathConstraint
Validates that a path or filename are not longer than a fixed number of characters or bytes
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Validates that a path meets a defined constraintvoid
Validates that a filename meets a defined constraintstatic PathLengthConstraint
maxBytes
(int maxLength) Creates a new constraint that limits the number of bytes in a pathstatic PathLengthConstraint
maxChars
(int maxLength) Creates a new constraint that limits the number of characters in a path
-
Constructor Details
-
PathLengthConstraint
-
-
Method Details
-
maxChars
Creates a new constraint that limits the number of characters in a path- Parameters:
maxLength
- maximum number of characters- Returns:
- constraint
-
maxBytes
Creates a new constraint that limits the number of bytes in a path- Parameters:
maxLength
- maximum number of bytes- Returns:
- constraint
-
apply
Validates that a path meets a defined constraint- Specified by:
apply
in interfacePathConstraint
- Parameters:
path
- the path to validate
-
apply
Validates that a filename meets a defined constraint- Specified by:
apply
in interfaceFileNameConstraint
- Parameters:
fileName
- the filename to validatepath
- the path the filename is part of. This is supplied for context and is not validated
-