Class FilenameUtils

java.lang.Object
org.apache.commons.io.FilenameUtils
io.toro.martini.util.FilenameUtils

public class FilenameUtils extends org.apache.commons.io.FilenameUtils
General filename and file path manipulation utilities.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String[]
    Names of OS-specific files.
    static final String[]
    Names of OS-specific folders.

    Fields inherited from class org.apache.commons.io.FilenameUtils

    EXTENSION_SEPARATOR, EXTENSION_SEPARATOR_STR
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    anyWildcardMatch(String[] filenames, String wildcardMatcher, org.apache.commons.io.IOCase caseSensitivity)
    Checks if any of the entries in filenames matches wildcardMatcher.
    static boolean
    Checks if given argument filename represents an OS-specific file/folder.
    Normalizes all entries of filenames.
    static String
    replaceExtension(String fileName, String ext)
     

    Methods inherited from class org.apache.commons.io.FilenameUtils

    concat, directoryContains, equals, equals, equalsNormalized, equalsNormalizedOnSystem, equalsOnSystem, getBaseName, getExtension, getFullPath, getFullPathNoEndSeparator, getName, getPath, getPathNoEndSeparator, getPrefix, getPrefixLength, indexOfExtension, indexOfLastSeparator, isExtension, isExtension, isExtension, normalize, normalize, normalizeNoEndSeparator, normalizeNoEndSeparator, removeExtension, separatorsToSystem, separatorsToUnix, separatorsToWindows, wildcardMatch, wildcardMatch, wildcardMatchOnSystem

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • OS_SPECIFIC_FILES

      public static final String[] OS_SPECIFIC_FILES
      Names of OS-specific files. Note: uses the characters '?' and '*' to represent a single or multiple wildcard characters.
    • OS_SPECIFIC_FOLDERS

      public static final String[] OS_SPECIFIC_FOLDERS
      Names of OS-specific folders. Note: uses the characters '?' and '*' to represent a single or multiple wildcard characters.
  • Method Details

    • isOSSpecificFile

      public static boolean isOSSpecificFile(String filename)
      Checks if given argument filename represents an OS-specific file/folder. A file/folder is deemed OS-specific if: The filename can be in either Unix or Windows format and is additionally, normalized before the actual check, so paths with single or double path steps are welcome.
      Parameters:
      filename - to check
      Returns:
      true if filename represents an OS-specific file; otherwise false
    • anyWildcardMatch

      public static boolean anyWildcardMatch(String[] filenames, String wildcardMatcher, org.apache.commons.io.IOCase caseSensitivity)
      Checks if any of the entries in filenames matches wildcardMatcher. Delegates individual entry matching to FilenameUtils.wildcardMatch(String, String, IOCase).
      Parameters:
      filenames - the filenames to match on
      wildcardMatcher - the wildcard string to match against
      caseSensitivity - what case sensitivity rule to use, null means case-sensitive
      Returns:
      true if any of the entries in filenames matches wildcardMatcher
    • replaceExtension

      public static String replaceExtension(String fileName, String ext)
    • normalize

      public static Collection<String> normalize(Collection<String> filenames)
      Normalizes all entries of filenames. Delegates to FilenameUtils.normalize(String).
      Parameters:
      filenames - the filenames to normalize, null returns null
      Returns:
      a new collection containing the normalized filenames, null whenever invalid
      See Also:
      • FilenameUtils.normalize(String)