public abstract class FileConfiguration extends MemoryConfiguration
Configurationdefs, 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 abstract @NotNull String |
buildHeader()
Loads this
FileConfiguration from the specified string, as
opposed to from file. |
void |
load(@NotNull File file)
Loads this
FileConfiguration from the specified reader. |
void |
load(@NotNull Reader reader)
Loads this
FileConfiguration from the specified location. |
void |
load(@NotNull String fileName)
Loads this
FileConfiguration from the specified location. |
abstract void |
loadFromString(@NotNull String data)
Loads this
FileConfiguration from the specified string, as
opposed to from file. |
@NotNull FileConfigurationOptions |
options()
Gets the
ConfigurationOptions for this Configuration. |
void |
save(@NotNull File file)
Saves this
FileConfiguration to the specified location. |
void |
save(@NotNull String fileName)
Saves this
FileConfiguration to the specified location. |
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, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByte, getByte, getByteList, getChar, getChar, getCharList, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, 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, setpublic FileConfiguration()
FileConfiguration with no default values.public FileConfiguration(@Nullable
@Nullable Configuration defs)
FileConfiguration using the specified Configuration as a source for all default values.defaults - Default value providerpublic void save(@NotNull
@NotNull File file)
throws IOException
FileConfiguration to the specified location.
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 exception will be thrown.
This method will save using the system default encoding, or possibly using UTF8.
file - File to save to.IOException - Thrown when the given file cannot be written to for
any reason.IllegalArgumentException - Thrown when file is null.public void save(@NotNull
@NotNull String fileName)
throws IOException
FileConfiguration to the specified location.
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 exception will be thrown.
This method will save using the system default encoding, or possibly using UTF8.
file - File to save to.IOException - Thrown when the given file cannot be written to for
any reason.IllegalArgumentException - Thrown when file is null.@NotNull public abstract @NotNull String saveToString()
FileConfiguration to a string, and returns it.public void load(@NotNull
@NotNull Reader reader)
throws IOException,
InvalidConfigurationException
FileConfiguration from the specified location.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given file.
If the file cannot be loaded for any reason, an exception will be thrown.
file - File to load from.FileNotFoundException - Thrown when the given file cannot be
opened.IOException - Thrown when the given file cannot be read.InvalidConfigurationException - Thrown when the given file is not
a valid Configuration.IllegalArgumentException - Thrown when file is null.public void load(@NotNull
@NotNull File file)
throws FileNotFoundException,
IOException,
InvalidConfigurationException
FileConfiguration from the specified reader.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given stream.
reader - the reader to load fromIOException - thrown when underlying reader throws an IOExceptionInvalidConfigurationException - thrown when the reader does not
represent a valid ConfigurationIllegalArgumentException - thrown when reader is nullFileNotFoundExceptionpublic void load(@NotNull
@NotNull String fileName)
throws FileNotFoundException,
IOException,
InvalidConfigurationException
FileConfiguration from the specified location.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given file.
If the file cannot be loaded for any reason, an exception will be thrown.
file - File to load from.FileNotFoundException - Thrown when the given file cannot be
opened.IOException - Thrown when the given file cannot be read.InvalidConfigurationException - Thrown when the given file is not
a valid Configuration.IllegalArgumentException - Thrown when file is null.public abstract void loadFromString(@NotNull
@NotNull String data)
throws InvalidConfigurationException
FileConfiguration from the specified string, as
opposed to from file.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.
If the string is invalid in any way, an exception will be thrown.
contents - Contents of a Configuration to load.InvalidConfigurationException - Thrown if the specified string is
invalid.IllegalArgumentException - Thrown if contents is null.@NotNull protected abstract @NotNull String buildHeader()
FileConfiguration from the specified string, as
opposed to from file.
All the values contained within this configuration will be removed, leaving only settings and defaults, and the new values will be loaded from the given string.
If the string is invalid in any way, an exception will be thrown.
contents - Contents of a Configuration to load.InvalidConfigurationException - Thrown if the specified string is
invalid.IllegalArgumentException - Thrown if contents is null.@NotNull public @NotNull FileConfigurationOptions options()
ConfigurationConfigurationOptions for this Configuration.
All setters through this method are chainable.
options in interface Configurationoptions in class MemoryConfigurationCopyright © 2020 BSPF Systems. All rights reserved.