Class PathLengthConstraint

java.lang.Object
io.ocfl.core.path.constraint.PathLengthConstraint
All Implemented Interfaces:
FileNameConstraint, PathConstraint

public class PathLengthConstraint extends Object implements PathConstraint, FileNameConstraint
Validates that a path or filename are not longer than a fixed number of characters or bytes
  • Constructor Details

  • Method Details

    • maxChars

      public static PathLengthConstraint maxChars(int maxLength)
      Creates a new constraint that limits the number of characters in a path
      Parameters:
      maxLength - maximum number of characters
      Returns:
      constraint
    • maxBytes

      public static PathLengthConstraint maxBytes(int maxLength)
      Creates a new constraint that limits the number of bytes in a path
      Parameters:
      maxLength - maximum number of bytes
      Returns:
      constraint
    • apply

      public void apply(String path)
      Validates that a path meets a defined constraint
      Specified by:
      apply in interface PathConstraint
      Parameters:
      path - the path to validate
    • apply

      public void apply(String fileName, String path)
      Validates that a filename meets a defined constraint
      Specified by:
      apply in interface FileNameConstraint
      Parameters:
      fileName - the filename to validate
      path - the path the filename is part of. This is supplied for context and is not validated