Class FilenameUtils


  • public class FilenameUtils
    extends FilenameUtils
    General filename and file path manipulation utilities.
    • Field Detail

      • 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 Detail

      • 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,
                                               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)