java.lang.Object
com.creativityfactory.swiftserver.utils.IOUtils

public class IOUtils extends Object
Utility class for input/output operations.
  • Constructor Details

    • IOUtils

      public IOUtils()
  • Method Details

    • fromBufferToString

      public static String fromBufferToString(BufferedReader reader)
      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

      public static String readFile(String path) throws IOException
      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

      public static void saveDataToFile(String data, String path) throws IOException
      Saves a string of data to a file at the specified path.
      Parameters:
      data - the data to write to the file
      path - the path to the file to write to
      Throws:
      IOException - if there is an error writing to the file