public abstract class FileConfiguration extends MemoryConfiguration
File-based implementations of
a MemoryConfiguration.
Synchronized with the commit on 20-December-2021.defs, optionsmap| Constructor and Description |
|---|
FileConfiguration()
Creates an empty
FileConfiguration with no default values. |
FileConfiguration(@Nullable Configuration defs)
Creates an empty
FileConfiguration using the specified
Configuration as a source for all default values. |
| Modifier and Type | Method and Description |
|---|---|
protected @NotNull String |
buildHeader()
Deprecated.
This method only exists for backwards compatibility. Use
FileConfigurationOptions.getHeader() instead. |
@NotNull FileConfigurationOptions |
getOptions()
Gets the
ConfigurationOptions for this Configuration. |
void |
load(@NotNull File file)
Loads this
FileConfiguration from the given File. |
void |
load(@NotNull Reader reader)
Loads this
FileConfiguration from the given Reader. |
void |
load(@NotNull String path)
Loads this
FileConfiguration from a File at the given
path. |
abstract void |
loadFromString(@NotNull String data)
Loads this
FileConfiguration from the given String. |
@NotNull FileConfigurationOptions |
options()
Deprecated.
|
void |
save(@NotNull File file)
Saves this
FileConfiguration to the given File. |
void |
save(@NotNull String path)
Saves this
FileConfiguration to a File at the given path. |
abstract @NotNull String |
saveToString()
Saves this
FileConfiguration to a String, and returns it. |
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaultscontains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharList, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInLineComments, getInt, getInt, getIntList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getRoot, getSerializable, getSerializable, getShort, getShort, getShortList, getString, getString, getStringList, getValues, isBoolean, isByte, isChar, isConfigurationSection, isDouble, isFloat, isInt, isList, isLong, isSet, isShort, isString, mapChildrenKeys, mapChildrenValues, set, setComments, setInLineComments, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharList, getComments, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInLineComments, getInt, getInt, getIntList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getRoot, getSerializable, getSerializable, getShort, getShort, getShortList, getString, getString, getStringList, getValues, isBoolean, isByte, isChar, isConfigurationSection, isDouble, isFloat, isInt, isList, isLong, isSet, isShort, isString, set, setComments, setInLineCommentspublic FileConfiguration()
FileConfiguration with no default values.public FileConfiguration(@Nullable
@Nullable Configuration defs)
FileConfiguration using the specified
Configuration as a source for all default values.defs - Default value providerpublic final void save(@NotNull
@NotNull File file)
throws IOException
FileConfiguration to the given File.
If the File does not exist, it will be created. If already
exists, it will be overwritten. If it cannot be overwritten or created,
an IOException will be thrown.
This method will save using StandardCharsets.UTF_8.
file - The File to save to.IOException - If the File cannot be written to.saveToString()public final void save(@NotNull
@NotNull String path)
throws IOException
FileConfiguration to a File at the given path.
If the File does not exist, it will be created. If already
exists, it will be overwritten. If it cannot be overwritten or created,
an IOException will be thrown.
This method will save using StandardCharsets.UTF_8.
path - The path of the File to save to.IOException - If the File cannot be written to.save(File)@NotNull public abstract @NotNull String saveToString()
FileConfiguration to a String, and returns it.String containing this FileConfiguration.public final void load(@NotNull
@NotNull Reader reader)
throws IOException,
InvalidConfigurationException
FileConfiguration from the given Reader.
All values contained in-memory in this FileConfiguration will be
removed, leaving only the FileConfigurationOptions as well as any
defaults. The new values will be loaded into memory from the given
Reader.
reader - The Reader used to load this
FileConfiguration.IOException - If the given Reader encounters an error and
throws an IOException.InvalidConfigurationException - If the data in the Reader
cannot be parsed as a
FileConfiguration.loadFromString(String)public final void load(@NotNull
@NotNull File file)
throws IOException,
InvalidConfigurationException
FileConfiguration from the given File.
All values contained in-memory in this FileConfiguration will be
removed, leaving only the FileConfigurationOptions as well as any
defaults. The new values will be loaded into memory from the given
File.
file - The File used to load this FileConfiguration.IOException - If the given File cannot be read.InvalidConfigurationException - If the data in the File
cannot be parsed as a
FileConfiguration.load(Reader)public final void load(@NotNull
@NotNull String path)
throws IOException,
InvalidConfigurationException
FileConfiguration from a File at the given
path.
All values contained in-memory in this FileConfiguration will be
removed, leaving only the FileConfigurationOptions as well as any
defaults. The new values will be loaded into memory from the File
at the given path.
path - The path of the File to load from.IOException - If the File cannot be read.InvalidConfigurationException - If the data in the File
cannot be parsed as a
FileConfiguration.load(File)public abstract void loadFromString(@NotNull
@NotNull String data)
throws InvalidConfigurationException
FileConfiguration from the given String.
All values contained in-memory in this FileConfiguration will be
removed, leaving only the FileConfigurationOptions as well as any
defaults. The new values will be loaded into memory from the
String.
data - A String representation of the
FileConfiguration data to load.InvalidConfigurationException - If the given String cannot
be parsed as a
FileConfiguration.@Deprecated @NotNull protected final @NotNull String buildHeader()
FileConfigurationOptions.getHeader() instead.String. Please use
FileConfigurationOptions.getHeader() instead.String.FileConfigurationOptions.getHeader()@NotNull public @NotNull FileConfigurationOptions getOptions()
ConfigurationOptions for this Configuration.
All setters through this method are chainable.
getOptions in interface ConfigurationgetOptions in class MemoryConfigurationConfigurationOptions for this Configuration.@Deprecated @NotNull public @NotNull FileConfigurationOptions options()
Please use Configuration.getOptions() instead; it provides the
same functionality.
options in interface Configurationoptions in class MemoryConfigurationConfigurationOptions for this Configuration.Configuration.getOptions()Copyright © 2022 BSPF Systems, LLC. All rights reserved.