Package com.jackmeng.locale
Class FileParser
java.lang.Object
com.jackmeng.locale.FileParser
A simply utility that helps
with parsing information regarding files or a folder.
- Since:
- 3.0
- Author:
- Jack Meng
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkDirExistence
(String locale) static boolean
Returns if a folder contains in any way a file with the specified extension.static String
folderName
(String f) This method parses a folder's namestatic boolean
isEmptyFolder
(File folder) Checks if the folder is empty (void of any files)static String[]
parseFileNames
(File... files) This method returns a string array of file names from the given varargs of files to parse.static File[]
parseOnlyAudioFiles
(File folder, String[] rules) This method parses files with a certain extension.static void
writeBOM
(OutputStream os, String encoding)
-
Constructor Details
-
FileParser
private FileParser()Irrelevant constructor :(
-
-
Method Details
-
parseOnlyAudioFiles
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
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
This method parses a folder's name- Parameters:
f
- The folder to parse- Returns:
- The name of the folder
Very useless method
-
parseFileNames
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
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
- Parameters:
locale
-- Returns:
- boolean
-
writeBOM
- Parameters:
os
-encoding
-- Throws:
IOException
-