Package de.muehlencord.shared.util.file
Class FileUtil
java.lang.Object
de.muehlencord.shared.util.file.FileUtil
- Author:
- Joern Muehlencord (joern@muehlencord.de)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancopyFileTo(File source, File destination) Deprecated.use Files.copy insteadstatic booleandoesPathExists(String path) returns true, if the givn path exists; false otherwisestatic FilegetFileName(String outputFolder, Format ft, int number) returns a file handle to a file in the given folder using the given formater and the given number.getFilesFromDirecotry(String directory, String regEx) returns a list of files found by the given regexp in the given folderstatic Stringstatic booleanmoveFileTo(File source, File destination) moves / renames the given file to the new filestatic StringReads the content of the given file and returns it as String
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
getFilesFromDirecotry
public static List<File> getFilesFromDirecotry(String directory, String regEx) throws FileHandlingException returns a list of files found by the given regexp in the given folder- Parameters:
directory- the folder to search in as a stringregEx- the regular expression to search with- Returns:
- a list of files
- Throws:
FileHandlingException- if the given directory cannot be found
-
getFileName
returns a file handle to a file in the given folder using the given formater and the given number.- Parameters:
outputFolder- the folder to link the file to as strnigft- a format object to use to format the filename of the given filenumber- a number used to call the given formater to name the file number- Returns:
- a file handle build from formater and number linked to given directory
-
copyFileTo
Deprecated.use Files.copy insteadcopies the given source file to the given destination filename- Parameters:
source- the file to copy fromdestination- the destination filename to copy the source file to- Returns:
- true, if the vile was copied, false, else
-
moveFileTo
moves / renames the given file to the new file- Parameters:
source- the source filedestination- the file to rename the source file to- Returns:
- true, if move / rename was successfull; false else
-
doesPathExists
returns true, if the givn path exists; false otherwise- Parameters:
path- the path to check- Returns:
- true, if the givn path exists; false otherwise
-
md5Sum
- Throws:
IOException
-
readFile
Reads the content of the given file and returns it as String- Parameters:
inputFile- the input file to readencoding- the encoding of the file to load- Returns:
- the content of the file as string
- Throws:
IOException- if the file cannot be read
-