Package io.github.the_sdet.files
Class FileUtils
java.lang.Object
io.github.the_sdet.files.FileUtils
This class handles all File Handling related Utilities and Helper methods
- Author:
- Pabitra Swain ([email protected])
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilebyteArrayToFile(byte[] data, String type) Converts a byte array to a file.static booleancheckFileExistence(String fileNameWithPath) checks existence of a filestatic voidcleanOrCreateDirectory(String folderPath) This method deletes the files and folders inside a directorystatic voidCopies a file from the source to the destination.static voidCopies a file from the source to the destination with metadata.static StringfileNameWithTimeStamp(String fileName, String timeStampPattern) creates filename appending timestamp
-
Constructor Details
-
FileUtils
public FileUtils()
-
-
Method Details
-
checkFileExistence
checks existence of a file- Parameters:
fileNameWithPath- provide file name with path- Returns:
- true/false - returns true if the file exists
-
cleanOrCreateDirectory
This method deletes the files and folders inside a directory- Parameters:
folderPath- folder path
-
copyFile
Copies a file from the source to the destination.- Parameters:
source- The source file.destination- The destination file.
-
copyFile
Copies a file from the source to the destination with metadata.- Parameters:
source- The source file.destination- The destination file.metadata- The metadata information.
-
byteArrayToFile
Converts a byte array to a file.- Parameters:
data- The byte array data.type- jpg/png- Returns:
- The file created from the byte array.
-
fileNameWithTimeStamp
creates filename appending timestamp- Parameters:
fileName- provide filenametimeStampPattern- provide time stamp pattern- Returns:
- Custom filename
-