Package me.gigawartrex.smalladditions.io
Class FileHelper
java.lang.Object
me.gigawartrex.smalladditions.io.FileHelper
- Direct Known Subclasses:
Config
Class for handling general file interactions.
- Author:
- Paul Ferlitz
-
Constructor Summary
ConstructorsConstructorDescriptionFileHelper
(String fileName) Constructor to create one file in the base plugin directory.FileHelper
(String path, String fileName) Constructor to create one file in a custom directory. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Method to check for a file's existence.boolean
Method to create a file.boolean
Method to delete a file.Method to return the file name.org.bukkit.configuration.file.YamlConfiguration
loadFile()
Method to return a file.boolean
saveFile
(org.bukkit.configuration.file.YamlConfiguration file) Method to save a file.
-
Constructor Details
-
FileHelper
Constructor to create one file in the base plugin directory.- Parameters:
fileName
- the name of the file without a file suffix
-
FileHelper
Constructor to create one file in a custom directory.- Parameters:
path
- the path of the file inside the plugin's base directoryfileName
- the name of the file without a file suffix
-
-
Method Details
-
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
-