Class FileUtils
java.lang.Object
dimstyl.orm.internal.utils.FileUtils
Utility class for file operations.
This class provides a method to write content to a file and return its absolute path.
Usage Example:
try {
String path = FileUtils.writeToFileAndGetAbsolutePath("output.txt", "Hello, World!");
System.out.println("File saved at: " + path);
} catch (IOException e) {
e.printStackTrace();
}
Design Notes:
- This class is
finalto prevent inheritance. - The constructor is private to enforce a static utility pattern.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringwriteToFileAndGetAbsolutePath(String fileName, String content) Writes the given content to a file and returns its absolute path.
-
Constructor Details
-
FileUtils
private FileUtils()Private constructor to prevent instantiation.
-
-
Method Details
-
writeToFileAndGetAbsolutePath
public static String writeToFileAndGetAbsolutePath(String fileName, String content) throws IOException Writes the given content to a file and returns its absolute path.- Parameters:
fileName- The name (or relative path) of the file to write.content- The content to be written to the file.- Returns:
- The absolute path of the created file.
- Throws:
IOException- If an I/O error occurs during file writing.
-