public class FileUtil extends Object
| Constructor | Description |
|---|---|
FileUtil() |
| Modifier and Type | Method | Description |
|---|---|---|
static File |
createTempFile(String fileNameInsideJar) |
Create a temp file from the file inside the jar.
|
static String |
dropExtension(String fileName) |
Drop the extension part of the given file path and return only the file name without extension.
|
static String |
getExtension(String fileName) |
Get the extension of the give file name.
|
static String |
readResourceFile(String fileLocation) |
Read a text resource file and return the full content as String.
|
static String |
readResourceFile(String fileLocation,
String lineSeparator) |
Read a text resource file and return the full content as String.
|
static void |
renameAllTempFiles(File watchDir) |
Renames all .tmp file to .csv file in the given directory
|
static boolean |
renameTmpFile(String fileName,
boolean changeFolder,
String newFolderExtension) |
Rename the given file and move to a new folder if required.
|
public static String readResourceFile(String fileLocation)
fileLocation - absolute or related name of the file to be read.public static String readResourceFile(String fileLocation, String lineSeparator)
fileLocation - absolute or related name of the file to be read.lineSeparator - Separator string for each line after reading.public static void renameAllTempFiles(File watchDir)
watchDir - Directory, where there are potential .tmp filepublic static boolean renameTmpFile(String fileName, boolean changeFolder, String newFolderExtension)
fileName - Original file name which will be renamed.changeFolder - if this value is true, renamed file will be moved to a new folder with given extension.newFolderExtension - if changeFolder is true, then this string will be treated as new folder's
suffix extension. For example this value can be 'Processed'.public static String getExtension(String fileName)
fileName - The file name from where extension will be parsed. This value can be either absolute file path
or relative file path or only file name.public static String dropExtension(String fileName)
fileName - The file name with extension.public static File createTempFile(String fileNameInsideJar)
fileNameInsideJar - Name of the file inside the jar. The file must be in the resource root directory of the
jar.Copyright © 2025. All rights reserved.