Class FileContentsDelegate
java.lang.Object
com.redhat.parodos.patterndetection.clue.delegate.FileContentsDelegate
Helper methods for working with Files and their contents.
- Author:
- Luke Shannon (Github: lshannon)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfileContentsToList(File currentFile) Gets the contents of a file as List of StringsgetFilePaths(String basePath) Provides a list of Files in a base directorygetFolderPaths(String basePath) Provides a list of Folders (and Sub Folders) under a base directoryvoidA recursive method that updates the passed in List of strings to contains the paths of each file/folder found under the directory
-
Constructor Details
-
FileContentsDelegate
public FileContentsDelegate()
-
-
Method Details
-
getFilePaths
Provides a list of Files in a base directory- Parameters:
basePath-- Returns:
- list of Strings containing the full path of all the files in the base directory
- Throws:
IOException
-
getFolderPaths
Provides a list of Folders (and Sub Folders) under a base directory- Parameters:
basePath-- Returns:
- List of String values, each value containing the full path of a folder or sub-folder found under the base directory
- Throws:
IOException
-
getPaths
A recursive method that updates the passed in List of strings to contains the paths of each file/folder found under the directory- Parameters:
dir- Current location in the scan (can be a file or folder). If its a folder it triggers a recursive callbase- the location from which the scan startedpaths- the list of file system locations as a String that is being recursively brought up
-
fileContentsToList
Gets the contents of a file as List of Strings- Parameters:
currentFile-- Returns:
- List of Strings with the contents of the file
- Throws:
IOException
-