Package org.bukkit.configuration.file

# Class YamlConfiguration

java.lang.Object
org.bukkit.configuration.MemorySection
org.bukkit.configuration.MemoryConfiguration
org.bukkit.configuration.file.FileConfiguration
org.bukkit.configuration.file.YamlConfiguration

All Implemented Interfaces:
  `Configuration`, `ConfigurationSection`

public class YamlConfiguration extends FileConfiguration
An implementation of `Configuration` which saves all files in Yaml. Note that this implementation is not synchronized.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final String`
`BLANK_CONFIG`
Deprecated.
unused, not intended to be API
`protected static final String`
`COMMENT_PREFIX`
Deprecated.
unused, not intended to be API

### Fields inherited from class org.bukkit.configuration.MemoryConfiguration

`defaults, options`

### Fields inherited from class org.bukkit.configuration.MemorySection

`map`

## Constructor Summary

Constructors
Constructor
Description
`YamlConfiguration()`

## Method Summary

Modifier and Type
Method
Description
`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 contents)`
Loads this `FileConfiguration` from the specified string, as opposed to from file.
`@NotNull YamlConfigurationOptions`
`options()`
Gets the `ConfigurationOptions` for this `Configuration`.
`@NotNull String`
`saveToString()`
Saves this `FileConfiguration` to a string, and returns it.

### Methods inherited from class org.bukkit.configuration.file.FileConfiguration

`buildHeader, load, load, load, save, save`

### Methods inherited from class org.bukkit.configuration.MemoryConfiguration

`addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults`

### Methods inherited from class org.bukkit.configuration.MemorySection

`contains, contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, setComments, setInlineComments, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.bukkit.configuration.ConfigurationSection

`contains, contains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getComments, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInlineComments, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLocation, getLocation, getLong, getLong, getLongList, getMapList, getName, getObject, getObject, getOfflinePlayer, getOfflinePlayer, getRoot, getSerializable, getSerializable, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLocation, isLong, isOfflinePlayer, isSet, isString, isVector, set, setComments, setInlineComments`

## Field Details

### COMMENT_PREFIX

@Deprecated protected static final String COMMENT_PREFIX
Deprecated.
unused, not intended to be API

See Also:
  - Constant Field Values

### BLANK_CONFIG

@Deprecated protected static final String BLANK_CONFIG
Deprecated.
unused, not intended to be API

See Also:
  - Constant Field Values

## Constructor Details

### YamlConfiguration

public YamlConfiguration()

## Method Details

### saveToString

@NotNull public @NotNull String saveToString()
Description copied from class: `FileConfiguration`
Saves this `FileConfiguration` to a string, and returns it.

Specified by:
  `saveToString` in class `FileConfiguration`
Returns:
  String containing this configuration.

### loadFromString

public void loadFromString(@NotNull @NotNull String contents) throws InvalidConfigurationException
Description copied from class: `FileConfiguration`
Loads this `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.

Specified by:
  `loadFromString` in class `FileConfiguration`
Parameters:
  `contents` - Contents of a Configuration to load.
Throws:
  `InvalidConfigurationException` - Thrown if the specified string is invalid.

### options

@NotNull public @NotNull YamlConfigurationOptions options()
Description copied from interface: `Configuration`
Gets the `ConfigurationOptions` for this `Configuration`.

All setters through this method are chainable.

Specified by:
  `options` in interface `Configuration`
Overrides:
  `options` in class `FileConfiguration`
Returns:
  Options for this configuration

### loadConfiguration

@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull File file)
Creates a new `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.

Parameters:
  `file` - Input file
Returns:
  Resulting configuration
Throws:
  `IllegalArgumentException` - Thrown if file is null

### loadConfiguration

@NotNull public static @NotNull YamlConfiguration loadConfiguration(@NotNull @NotNull Reader reader)
Creates a new `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.

Parameters:
  `reader` - input
Returns:
  resulting configuration
Throws:
  `IllegalArgumentException` - Thrown if stream is null