Package panda.utilities
Class FileUtils
java.lang.Object
panda.utilities.FileUtils
-
Method Summary
Modifier and TypeMethodDescriptioncollectFiles(File directory) Collect all files (including files from subdirectories) from the given directorystatic booleanCheck if a file is in the specified arraystatic booleanDelete file or directory with contentstatic Collection<File>findFilesByExtension(File directory, String extension) static Collection<File>findFilesByExtension(String directory, String extension) static intgetAmountOfFiles(File directory) Count files in the specified directorystatic String[]getContentAsLines(File file) static StringgetContentOfFile(File file) static StringGet file name without extensionstatic StringGet file name of pathstatic StringGet file name of URLstatic voidoverrideFile(File file, String content) Override content of the specified filestatic File[]Get vararg paths as array ofFile
-
Method Details
-
contains
Check if a file is in the specified array- Parameters:
files- filesfileName- name of file- Returns:
- true if file is in specified array
-
getAmountOfFiles
Count files in the specified directory- Parameters:
directory- root directory- Returns:
- amount of files
-
getContentOfFile
- Returns:
- content of the specified file
- Throws:
IOException
-
getContentAsLines
- Returns:
- content of file divided by lines
- Throws:
IOException
-
findFilesByExtension
- Returns:
- collection of file with the specified extension
-
findFilesByExtension
- Returns:
- collection of file with the specified extension
-
collectFiles
Collect all files (including files from subdirectories) from the given directory- Parameters:
directory- root- Returns:
- tree node of collected files
-
overrideFile
Override content of the specified file- Throws:
IOException
-
delete
Delete file or directory with content- Parameters:
file- file/directory- Returns:
- true if succeeded
-
toFiles
Get vararg paths as array ofFile- Parameters:
paths- array of paths- Returns:
- array of files
-
getName
Get file name without extension- Returns:
- file name without extension
-
getName
Get file name of URL- Parameters:
url- the url to check- Returns:
- the name of file
-
getName
Get file name of path- Parameters:
path- the path to check- Returns:
- the name of file
-