Class FileHelper

java.lang.Object
me.gigawartrex.smalladditions.io.FileHelper
Direct Known Subclasses:
Config

public abstract class FileHelper extends Object
Class for handling general file interactions.
Author:
Paul Ferlitz
  • Constructor Details

    • FileHelper

      public FileHelper(String fileName)
      Constructor to create one file in the base plugin directory.
      Parameters:
      fileName - the name of the file without a file suffix
    • FileHelper

      public FileHelper(String path, String fileName)
      Constructor to create one file in a custom directory.
      Parameters:
      path - the path of the file inside the plugin's base directory
      fileName - the name of the file without a file suffix
  • Method Details

    • getFileName

      public String getFileName()
      Method to return the file name.
      Returns:
      the file name
    • loadFile

      public org.bukkit.configuration.file.YamlConfiguration loadFile()
      Method to return a file.
      Returns:
      the file associated with this object
    • saveFile

      public boolean saveFile(org.bukkit.configuration.file.YamlConfiguration file)
      Method to save a file.
      Parameters:
      file - the file which should be saved
      Returns:
      True if the operation was successful
    • checkForFile

      public boolean checkForFile()
      Method to check for a file's existence.
      Returns:
      True if the file exists
    • deleteFile

      public boolean deleteFile()
      Method to delete a file.
      Returns:
      True if the operation was successful
    • createFile

      public boolean createFile()
      Method to create a file.
      Returns:
      True if operation was successful