Package main.Utils
Class FileHandler
java.lang.Object
main.Utils.FileHandler
Provide methods to read and write file
The class does not have any public constructors and should be used as a static utility class.
- Since:
- 2023-4-13
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Method to find if target exist in filestatic String[]
Method to read filestatic void
Method to write input string to target line
-
Constructor Details
-
FileHandler
public FileHandler()
-
-
Method Details
-
readFile
Method to read file- Parameters:
filePath
- file to readcheck
- input to match againstcol
- column to check for "check"- Returns:
- Returns the line as String[] seperated by comma if match found, else return null
-
findFile
Method to find if target exist in file- Parameters:
filePath
- file to checkcheck
- target to match forcol
- column in csv to find target- Returns:
- True if found, else return False
-
writeFile
Method to write input string to target line- Parameters:
filepath
- file to write tocheck
- target to match againstcol
- column in csv to find targetnewString
- new string to be written over target line
-