Class IOUtils
java.lang.Object
com.creativityfactory.swiftserver.utils.IOUtils
Utility class for input/output operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
fromBufferToString
(BufferedReader reader) Converts the contents of a BufferedReader object to a string.static String
Reads the contents of a file at the specified path and returns it as a string.static void
saveDataToFile
(String data, String path) Saves a string of data to a file at the specified path.
-
Constructor Details
-
IOUtils
public IOUtils()
-
-
Method Details
-
fromBufferToString
Converts the contents of a BufferedReader object to a string.- Parameters:
reader
- a BufferedReader object- Returns:
- a string containing the contents of the BufferedReader object
-
readFile
Reads the contents of a file at the specified path and returns it as a string.- Parameters:
path
- the path to the file to read- Returns:
- a string containing the contents of the file
- Throws:
IOException
- if there is an error reading the file
-
saveDataToFile
Saves a string of data to a file at the specified path.- Parameters:
data
- the data to write to the filepath
- the path to the file to write to- Throws:
IOException
- if there is an error writing to the file
-