Class FileIO

java.lang.Object
org.tasktide.core.supporting.FileIO

public class FileIO extends Object
Collection of useful File I/O methods
  • Constructor Details

    • FileIO

      public FileIO()
  • Method Details

    • fetchBufferedReader

      public static BufferedReader fetchBufferedReader(String resourcePath) throws IOException
      Fetch buffered reader for provided file
      Parameters:
      resourcePath -
      Returns:
      BufferedReader
      Throws:
      IOException
    • fetchBufferedWriter

      public static BufferedWriter fetchBufferedWriter(String resourcePath) throws IOException
      Fetch buffered writer for provided file
      Parameters:
      resourcePath -
      Returns:
      BufferedWriter
      Throws:
      IOException
    • fetchFileWriter

      public static FileWriter fetchFileWriter(String filePath) throws IOException
      Fetch file writer for provided file
      Parameters:
      filePath -
      Returns:
      FileWriter
      Throws:
      IOException
    • fetchFileReader

      public static FileReader fetchFileReader(String filePath) throws IOException
      Fetch file reader for provided file
      Parameters:
      filePath -
      Returns:
      FileReader
      Throws:
      IOException
    • exportJson

      public static <T> boolean exportJson(boolean prettyPrint, T data, String outFile)
      Export provided dataset to the target output file, flagging whether to indent resulting JSON doc
      Type Parameters:
      T -
      Parameters:
      prettyPrint -
      data -
      outFile -
      Returns:
      boolean
    • importJson

      public static <T> List<T> importJson(String outFile, Class<T> refClass)
      Reads input file to a collection of provided reference classes
      Type Parameters:
      T -
      Parameters:
      outFile -
      refClass -
      Returns:
      List-T