public final class YamlConfiguration extends FileConfiguration
Configuration which saves all files in Yaml.
Note that this implementation is not synchronized.
Synchronized with the commit on 21-December-2019.| Modifier and Type | Field and Description |
|---|---|
protected static String |
BLANK_CONFIG |
protected static String |
COMMENT_PREFIX |
defs, optionsmap| Constructor and Description |
|---|
YamlConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
protected @NotNull String |
buildHeader()
Compiles the header for this
FileConfiguration and returns the
result. |
protected void |
convertMapsToSections(@NotNull Map<?,?> map,
@NotNull ConfigurationSection section)
Converts the given
Map data into a ConfigurationSection,
loading it into the given ConfigurationSection. |
static @NotNull YamlConfiguration |
loadConfiguration(@NotNull File file)
Creates a new
YamlConfiguration, loading from the given file. |
static @NotNull YamlConfiguration |
loadConfiguration(@NotNull Reader reader)
Creates a new
YamlConfiguration, loading from the given reader. |
void |
loadFromString(@NotNull String data)
Loads this
FileConfiguration from the specified string, as
opposed to from file. |
@NotNull YamlConfigurationOptions |
options()
Gets the
ConfigurationOptions for this Configuration. |
protected @NotNull String |
parseHeader(@NotNull String data)
Parses the YAML header from the given data.
|
@NotNull String |
saveToString()
Saves this
FileConfiguration to a string, and returns it. |
load, load, load, save, saveaddDefault, 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, setprotected static final String COMMENT_PREFIX
protected static final String BLANK_CONFIG
@NotNull public @NotNull String saveToString()
FileConfiguration to a string, and returns it.saveToString in class FileConfigurationpublic 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.
loadFromString in class FileConfigurationdata - Contents of a Configuration to load.InvalidConfigurationException - Thrown if the specified string is
invalid.protected void convertMapsToSections(@NotNull
@NotNull Map<?,?> map,
@NotNull
@NotNull ConfigurationSection section)
Map data into a ConfigurationSection,
loading it into the given ConfigurationSection.map - The data to convert.section - The ConfigurationSection that will hold the
converted data.@NotNull protected @NotNull String parseHeader(@NotNull @NotNull String data)
data - The data to parse the header from.@NotNull protected @NotNull String buildHeader()
FileConfiguration and returns the
result.
This will use the header from FileConfiguration.options() -> FileConfigurationOptions.header(), respecting the rules of FileConfigurationOptions.copyHeader() if set.
buildHeader in class FileConfiguration@NotNull public @NotNull YamlConfigurationOptions options()
ConfigurationOptions for this Configuration.
All setters through this method are chainable.
options in interface Configurationoptions in class FileConfiguration@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull File file)
YamlConfiguration, loading from the given file.
Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned.
The encoding used may follow the system dependent default.
file - Input fileIllegalArgumentException - Thrown if file is null@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull Reader reader)
YamlConfiguration, loading from the given reader.
Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned.
reader - inputIllegalArgumentException - Thrown if stream is nullCopyright © 2021 BSPF Systems, LLC. All rights reserved.