java.lang.Object
io.github.javaezlib.javaez.extensions.Files

public class Files extends Object
The Files extension for handling I/O with files.
Since:
1.0
Author:
Red050911
  • Constructor Details

    • Files

      public Files()
  • Method Details

    • openFileForReading

      public static void openFileForReading(String path)
      Opens a file in READ mode. Without calling this, readLine() will not work.
      Parameters:
      path - The path of the file to read.
      Since:
      1.0
    • openFileForWriting

      public static void openFileForWriting(String path, boolean append)
      Opens a file in WRITE mode. Without calling this, writeLine(String) will not work.
      Parameters:
      path - Path of the file to write.
      append - If we should append to the file. If true, new lines will be added. If false, the file will be replaced.
      Since:
      1.0
    • closeFile

      public static void closeFile()
      Closes any open files. You must run this after you are finished reading/writing to a file.
      Since:
      1.0
    • readLine

      public static String readLine()
      Reads a line of a READ-MODE file. You must open a file this way using openFileForReading(String) or this will not work.
      Returns:
      The line read from the file, null if EOF
      Since:
      1.0
    • writeLine

      public static void writeLine(String line)
      Writes a line to a WRITE-MODE file. You must open a file this way using openFileForWriting(String, boolean) or this will not work.
      Parameters:
      line - What to write to the file.
      Since:
      1.0
    • makeFile

      public static void makeFile(String path)
      Makes a file
      Parameters:
      path - Where to create this file
      Since:
      1.4
    • makeFolder

      public static void makeFolder(String path)
      Makes a folder
      Parameters:
      path - Where to create this file
      Since:
      1.4
    • trashFile

      public static void trashFile(String path)
      Trashes a file or folder.
      Parameters:
      path - Path of the file to trash
      Since:
      1.4