Class YamlConfiguration
- All Implemented Interfaces:
Configuration,ConfigurationSection
Synchronized with the commit on 16-April-2023.
-
Field Summary
Fields inherited from class org.bspfsystems.yamlconfiguration.configuration.MemoryConfiguration
defs, options -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty YAML configuration with no default values.YamlConfiguration(@Nullable Configuration defs) Constructs an empty YAML configuration using the given configuration as a source for all default values. -
Method Summary
Modifier and TypeMethodDescription@NotNull YamlConfigurationOptionsGets the options for this configuration.static @NotNull YamlConfigurationloadConfiguration(@NotNull File file) Creates a new YAML configuration, loading from the given file.static @NotNull YamlConfigurationloadConfiguration(@NotNull Reader reader) Creates a new YAML configuration, loading from the given reader.voidloadFromString(@NotNull String data) Loads this file configuration from the given string.@NotNull StringConverts this file configuration to a string.Methods inherited from class org.bspfsystems.yamlconfiguration.file.FileConfiguration
load, load, load, save, saveMethods inherited from class org.bspfsystems.yamlconfiguration.configuration.MemoryConfiguration
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaultsMethods inherited from class org.bspfsystems.yamlconfiguration.configuration.MemorySection
clear, contains, contains, createPath, createPath, 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, isNumber, isSet, isShort, isString, set, setComments, setInlineComments, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bspfsystems.yamlconfiguration.configuration.ConfigurationSection
contains, 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, isNumber, isSet, isShort, isString, set, setComments, setInlineComments
-
Constructor Details
-
YamlConfiguration
public YamlConfiguration()Constructs an empty YAML configuration with no default values.- See Also:
-
YamlConfiguration
Constructs an empty YAML configuration using the given configuration as a source for all default values.- Parameters:
defs- The default value provider configuration- See Also:
-
-
Method Details
-
saveToString
Converts this file configuration to a string.- Specified by:
saveToStringin classFileConfiguration- Returns:
- A string representing this file configuration.
-
loadFromString
Loads this file configuration from the given string.All values contained in-memory in this file configuration will be removed, leaving only the file configuration options as well as any defaults. The new values will be loaded into memory from the given string.
- Specified by:
loadFromStringin classFileConfiguration- Parameters:
data- The string representation of the file configuration data to load.- Throws:
InvalidConfigurationException- If the given string cannot be parsed as a file configuration.
-
getOptions
Gets the options for this configuration.All setters through this method are chainable.
- Specified by:
getOptionsin interfaceConfiguration- Overrides:
getOptionsin classFileConfiguration- Returns:
- The options for this configuration.
-
loadConfiguration
Creates a new YAML configuration, loading from the given file.Any errors loading the YAML configuration will be logged and then otherwise ignored. If the given input is not a valid YAML configuration, an empty YAML configuration will be returned.
This will only load up to the default number of aliases (
YamlConfigurationOptions.getMaxAliases()) to prevent a Billion Laughs Attack.The encoding used may follow the system dependent default.
- Parameters:
file- The file to load.- Returns:
- The loaded YAML configuration.
-
loadConfiguration
@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull Reader reader) Creates a new YAML configuration, loading from the given reader.Any errors loading the YAML configuration will be logged and then otherwise ignored. If the given input is not a valid YAML configuration, an empty YAML configuration will be returned.
This will only load up to the default number of aliases (
YamlConfigurationOptions.getMaxAliases()) to prevent a Billion Laughs Attack.The encoding used may follow the system dependent default.
- Parameters:
reader- The reader to load.- Returns:
- The loaded YAML configuration.
-