Class FileParser

java.lang.Object
com.jackmeng.locale.FileParser

public final class FileParser extends Object
A simply utility that helps with parsing information regarding files or a folder.
Since:
3.0
Author:
Jack Meng
See Also:
  • Constructor Details

    • FileParser

      private FileParser()
      Irrelevant constructor :(
  • Method Details

    • parseOnlyAudioFiles

      public static File[] parseOnlyAudioFiles(File folder, String[] rules)
      This method parses files with a certain extension.
      Parameters:
      folder - The folder to search for, however this parameter must be guaranteed to be a folder and must exist and accessible.
      rules - An array of extensions to search for and compare to.
      Returns:
      An array of File objects that will be returned of all of the files that match the rules for the specified file extensions.
    • contains

      public static boolean contains(File folder, String[] rules)
      Returns if a folder contains in any way a file with the specified extension.
      Parameters:
      folder - The folder to search for, however this parameter must be guaranteed to be a folder and must exist and accessible.
      rules - An array of extensions to search for and compare to.
      Returns:
      True if the folder contains a file with the specified extension, false otherwise.
    • folderName

      public static String folderName(String f)
      This method parses a folder's name
      Parameters:
      f - The folder to parse
      Returns:
      The name of the folder

      Very useless method

    • parseFileNames

      public static String[] parseFileNames(File... files)
      This method returns a string array of file names from the given varargs of files to parse.
      Parameters:
      files - A varargs of files to parse
      Returns:
      A string array of file names
    • isEmptyFolder

      public static boolean isEmptyFolder(File folder)
      Checks if the folder is empty (void of any files)
      Parameters:
      folder - The folder to check
      Returns:
      True if the folder is empty, false otherwise
    • checkDirExistence

      public static boolean checkDirExistence(String locale)
      Parameters:
      locale -
      Returns:
      boolean
    • writeBOM

      public static void writeBOM(OutputStream os, String encoding) throws IOException
      Parameters:
      os -
      encoding -
      Throws:
      IOException