Class BitSetPathCharConstraint

java.lang.Object
io.ocfl.core.path.constraint.BitSetPathCharConstraint
All Implemented Interfaces:
PathCharConstraint

public class BitSetPathCharConstraint extends Object implements PathCharConstraint
Constraint that applies restrictions on what characters are allowed in file names.
  • Constructor Details

    • BitSetPathCharConstraint

      public BitSetPathCharConstraint(boolean blockList, BitSet charSet)
  • Method Details

    • blockList

      public static BitSetPathCharConstraint blockList(char... chars)
      Creates a constraint that rejects the specified characters
      Parameters:
      chars - the characters to reject
      Returns:
      constraint
    • blockListRange

      public static BitSetPathCharConstraint blockListRange(char start, char end)
      Creates a constraint that rejects all of the characters in the given range
      Parameters:
      start - beginning of range, inclusive
      end - end of range, inclusive
      Returns:
      constraint
    • acceptList

      public static BitSetPathCharConstraint acceptList(char... chars)
      Creates a constraint that only accepts the specified characters
      Parameters:
      chars - the characters to accept
      Returns:
      constraint
    • acceptListRange

      public static BitSetPathCharConstraint acceptListRange(char start, char end)
      Creates a constraint that accepts all of the characters in the given range
      Parameters:
      start - beginning of range, inclusive
      end - end of range, inclusive
      Returns:
      constraint
    • apply

      public void apply(char c, String path)
      Validates that the characters in a filename meet a defined constraint
      Specified by:
      apply in interface PathCharConstraint
      Parameters:
      c - the character to validate
      path - the path the character is part of. This is supplied for context and is not validated