Enum Class PathNormalization

java.lang.Object
java.lang.Enum<PathNormalization>
com.google.common.jimfs.PathNormalization
All Implemented Interfaces:
com.google.common.base.Function<String,String>, Serializable, Comparable<PathNormalization>, Constable, Function<String,String>

public enum PathNormalization extends Enum<PathNormalization> implements com.google.common.base.Function<String,String>
Normalizations that can be applied to names in paths. Includes Unicode normalizations and normalizations for case insensitive paths. These normalizations can be set in Configuration.Builder when creating a Jimfs file system instance and are automatically applied to paths in the file system.
  • Enum Constant Details

    • NONE

      public static final PathNormalization NONE
      No normalization.
    • NFC

      public static final PathNormalization NFC
      Unicode composed normalization (form NFC).
    • NFD

      public static final PathNormalization NFD
      Unicode decomposed normalization (form NFD).
    • CASE_FOLD_UNICODE

      public static final PathNormalization CASE_FOLD_UNICODE
      Unicode case folding for case insensitive paths. Requires ICU4J on the classpath.
    • CASE_FOLD_ASCII

      public static final PathNormalization CASE_FOLD_ASCII
      ASCII case folding for simple case insensitive paths.
  • Field Details

    • patternFlags

      private final int patternFlags
  • Constructor Details

    • PathNormalization

      private PathNormalization(int patternFlags)
  • Method Details

    • values

      public static PathNormalization[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PathNormalization valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • apply

      public abstract String apply(String string)
      Applies this normalization to the given string, returning the normalized result.
      Specified by:
      apply in interface com.google.common.base.Function<String,String>
      Specified by:
      apply in interface Function<String,String>
    • patternFlags

      public int patternFlags()
      Returns the flags that should be used when creating a regex Pattern in order to approximate this normalization.
    • normalize

      public static String normalize(String string, Iterable<PathNormalization> normalizations)
      Applies the given normalizations to the given string in order, returning the normalized result.
    • compilePattern

      public static Pattern compilePattern(String regex, Iterable<PathNormalization> normalizations)
      Compiles a regex pattern using flags based on the given normalizations.