Class FileSystem

java.lang.Object
blazing.fs.FileSystem

public class FileSystem extends Object
  • Method Details

    • readFileToString

      public static Result<String,FileNotFoundException> readFileToString(String path)
      Opens a file and reads the contents into a String
      Parameters:
      path -
      Returns:
      A result Object which has a string if successful and a FileNotFoundException if not.
    • writeToFile

      public static Result<Boolean,Exception> writeToFile(File fp, String data)
      Write the data into the file provided
      Parameters:
      fp -
      data -
      Returns:
      A Result Object with the boolean value true is successful and an Exception if not.
    • appendToFile

      public static Result<Boolean,Exception> appendToFile(File fp, String... data)
      Writes and appends the data provided into the file
      Parameters:
      fp -
      data -
      Returns:
      A Result Object with the boolean value true is successful and an Exception if not.
    • fileExtension

      public static String fileExtension(String path)
      Extracts the file extension of a file.
      Parameters:
      path -
      Returns:
      The file extension or null if there is none.