Class FilenameUtils

java.lang.Object
org.apache.mina.core.buffer.matcher.FilenameUtils

public class FilenameUtils extends Object
This class is extracted from Apache commons-io project
  • Field Details

    • NOT_FOUND

      private static final int NOT_FOUND
      See Also:
    • EMPTY_STRING_ARRAY

      private static final String[] EMPTY_STRING_ARRAY
    • UNIX_NAME_SEPARATOR

      private static final char UNIX_NAME_SEPARATOR
      The Unix separator character.
      See Also:
    • WINDOWS_NAME_SEPARATOR

      private static final char WINDOWS_NAME_SEPARATOR
      The Windows separator character.
      See Also:
  • Constructor Details

    • FilenameUtils

      public FilenameUtils()
  • Method Details

    • wildcardMatch

      public static boolean wildcardMatch(String fileName, String wildcardMatcher, IOCase ioCase)
      Checks a fileName to see if it matches the specified wildcard matcher allowing control over case-sensitivity.

      The wildcard matcher uses the characters '?' and '*' to represent a single or multiple (zero or more) wildcard characters. N.B. the sequence "*?" does not work properly at present in match strings.

      Parameters:
      fileName - the fileName to match on
      wildcardMatcher - the wildcard string to match against
      ioCase - what case sensitivity rule to use, null means case-sensitive
      Returns:
      true if the fileName matches the wildcard string
      Since:
      1.3
    • splitOnTokens

      static String[] splitOnTokens(String text)
      Splits a string into a number of tokens. The text is split by '?' and '*'. Where multiple '*' occur consecutively they are collapsed into a single '*'.
      Parameters:
      text - the text to split
      Returns:
      the array of tokens, never null
    • flipSeparator

      static char flipSeparator(char ch)
      Flips the Windows name separator to Linux and vice-versa.
      Parameters:
      ch - The Windows or Linux name separator.
      Returns:
      The Windows or Linux name separator.