Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.configuration.file.YamlConfiguration Class Reference
Inheritance diagram for org.bukkit.configuration.file.YamlConfiguration:
org.bukkit.configuration.file.FileConfiguration org.bukkit.configuration.MemoryConfiguration org.bukkit.configuration.MemorySection org.bukkit.configuration.Configuration org.bukkit.configuration.ConfigurationSection org.bukkit.configuration.ConfigurationSection

Public Member Functions

String saveToString ()
 
void loadFromString (String contents) throws InvalidConfigurationException
 
YamlConfigurationOptions options ()
 
- Public Member Functions inherited from org.bukkit.configuration.file.FileConfiguration
 FileConfiguration ()
 
 FileConfiguration (Configuration defaults)
 
void save (File file) throws IOException
 
void save (String file) throws IOException
 
abstract String saveToString ()
 
void load (File file) throws FileNotFoundException, IOException, InvalidConfigurationException
 
void load (InputStream stream) throws IOException, InvalidConfigurationException
 
void load (Reader reader) throws IOException, InvalidConfigurationException
 
void load (String file) throws FileNotFoundException, IOException, InvalidConfigurationException
 
abstract void loadFromString (String contents) throws InvalidConfigurationException
 
FileConfigurationOptions options ()
 
- Public Member Functions inherited from org.bukkit.configuration.MemoryConfiguration
 MemoryConfiguration ()
 
 MemoryConfiguration (Configuration defaults)
 
void addDefault (String path, Object value)
 
void addDefaults (Map< String, Object > defaults)
 
void addDefaults (Configuration defaults)
 
void setDefaults (Configuration defaults)
 
Configuration getDefaults ()
 
ConfigurationSection getParent ()
 
MemoryConfigurationOptions options ()
 
- Public Member Functions inherited from org.bukkit.configuration.MemorySection
Set< String > getKeys (boolean deep)
 
Map< String, Object > getValues (boolean deep)
 
boolean contains (String path)
 
boolean isSet (String path)
 
String getCurrentPath ()
 
String getName ()
 
Configuration getRoot ()
 
ConfigurationSection getParent ()
 
void addDefault (String path, Object value)
 
ConfigurationSection getDefaultSection ()
 
void set (String path, Object value)
 
Object get (String path)
 
Object get (String path, Object def)
 
ConfigurationSection createSection (String path)
 
ConfigurationSection createSection (String path, Map<?,?> map)
 
String getString (String path)
 
String getString (String path, String def)
 
boolean isString (String path)
 
int getInt (String path)
 
int getInt (String path, int def)
 
boolean isInt (String path)
 
boolean getBoolean (String path)
 
boolean getBoolean (String path, boolean def)
 
boolean isBoolean (String path)
 
double getDouble (String path)
 
double getDouble (String path, double def)
 
boolean isDouble (String path)
 
long getLong (String path)
 
long getLong (String path, long def)
 
boolean isLong (String path)
 
List<?> getList (String path)
 
List<?> getList (String path, List<?> def)
 
boolean isList (String path)
 
List< String > getStringList (String path)
 
List< Integer > getIntegerList (String path)
 
List< Boolean > getBooleanList (String path)
 
List< Double > getDoubleList (String path)
 
List< Float > getFloatList (String path)
 
List< Long > getLongList (String path)
 
List< Byte > getByteList (String path)
 
List< Character > getCharacterList (String path)
 
List< Short > getShortList (String path)
 
List< Map<?,?> > getMapList (String path)
 
Vector getVector (String path)
 
Vector getVector (String path, Vector def)
 
boolean isVector (String path)
 
OfflinePlayer getOfflinePlayer (String path)
 
OfflinePlayer getOfflinePlayer (String path, OfflinePlayer def)
 
boolean isOfflinePlayer (String path)
 
ItemStack getItemStack (String path)
 
ItemStack getItemStack (String path, ItemStack def)
 
boolean isItemStack (String path)
 
Color getColor (String path)
 
Color getColor (String path, Color def)
 
boolean isColor (String path)
 
ConfigurationSection getConfigurationSection (String path)
 
boolean isConfigurationSection (String path)
 
String toString ()
 

Static Public Member Functions

static YamlConfiguration loadConfiguration (File file)
 
static YamlConfiguration loadConfiguration (InputStream stream)
 
static YamlConfiguration loadConfiguration (Reader reader)
 
- Static Public Member Functions inherited from org.bukkit.configuration.MemorySection
static String createPath (ConfigurationSection section, String key)
 
static String createPath (ConfigurationSection section, String key, ConfigurationSection relativeTo)
 

Protected Member Functions

void convertMapsToSections (Map<?,?> input, ConfigurationSection section)
 
String parseHeader (String input)
 
String buildHeader ()
 
- Protected Member Functions inherited from org.bukkit.configuration.file.FileConfiguration
abstract String buildHeader ()
 
- Protected Member Functions inherited from org.bukkit.configuration.MemorySection
 MemorySection ()
 
 MemorySection (ConfigurationSection parent, String path)
 
boolean isPrimitiveWrapper (Object input)
 
Object getDefault (String path)
 
void mapChildrenKeys (Set< String > output, ConfigurationSection section, boolean deep)
 
void mapChildrenValues (Map< String, Object > output, ConfigurationSection section, boolean deep)
 

Static Protected Attributes

static final String COMMENT_PREFIX = "# "
 
static final String BLANK_CONFIG = "{}\n"
 

Additional Inherited Members

- Static Public Attributes inherited from org.bukkit.configuration.file.FileConfiguration
static final boolean UTF8_OVERRIDE
 
static final boolean UTF_BIG
 
static final boolean SYSTEM_UTF
 
- Protected Attributes inherited from org.bukkit.configuration.MemoryConfiguration
Configuration defaults
 
MemoryConfigurationOptions options
 
- Protected Attributes inherited from org.bukkit.configuration.MemorySection
final Map< String, Object > map = new LinkedHashMap<String, Object>()
 

Detailed Description

An implementation of Configuration which saves all files in Yaml. Note that this implementation is not synchronized.

Definition at line 25 of file YamlConfiguration.java.

Member Function Documentation

static YamlConfiguration org.bukkit.configuration.file.YamlConfiguration.loadConfiguration ( File  file)
static

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
fileInput file
Returns
Resulting configuration
Exceptions
IllegalArgumentExceptionThrown if file is null

Definition at line 174 of file YamlConfiguration.java.

References org.bukkit.Bukkit.getLogger(), and org.bukkit.configuration.file.FileConfiguration.load().

Referenced by org.bukkit.plugin.java.JavaPlugin.reloadConfig().

174  {
175  Validate.notNull(file, "File cannot be null");
176 
177  YamlConfiguration config = new YamlConfiguration();
178 
179  try {
180  config.load(file);
181  } catch (FileNotFoundException ex) {
182  } catch (IOException ex) {
183  Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
184  } catch (InvalidConfigurationException ex) {
185  Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file , ex);
186  }
187 
188  return config;
189  }
static YamlConfiguration org.bukkit.configuration.file.YamlConfiguration.loadConfiguration ( InputStream  stream)
static

Creates a new YamlConfiguration, loading from the given stream.

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
streamInput stream
Returns
Resulting configuration
Exceptions
IllegalArgumentExceptionThrown if stream is null
Deprecated:
does not properly consider encoding
See also
load(InputStream)
loadConfiguration(Reader)

Definition at line 206 of file YamlConfiguration.java.

References org.bukkit.Bukkit.getLogger(), and org.bukkit.configuration.file.FileConfiguration.load().

206  {
207  Validate.notNull(stream, "Stream cannot be null");
208 
209  YamlConfiguration config = new YamlConfiguration();
210 
211  try {
212  config.load(stream);
213  } catch (IOException ex) {
214  Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
215  } catch (InvalidConfigurationException ex) {
216  Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
217  }
218 
219  return config;
220  }
static YamlConfiguration org.bukkit.configuration.file.YamlConfiguration.loadConfiguration ( Reader  reader)
static

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
readerinput
Returns
resulting configuration
Exceptions
IllegalArgumentExceptionThrown if stream is null

Definition at line 234 of file YamlConfiguration.java.

References org.bukkit.Bukkit.getLogger(), and org.bukkit.configuration.file.FileConfiguration.load().

234  {
235  Validate.notNull(reader, "Stream cannot be null");
236 
237  YamlConfiguration config = new YamlConfiguration();
238 
239  try {
240  config.load(reader);
241  } catch (IOException ex) {
242  Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
243  } catch (InvalidConfigurationException ex) {
244  Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
245  }
246 
247  return config;
248  }
YamlConfigurationOptions org.bukkit.configuration.file.YamlConfiguration.options ( )

Gets the ConfigurationOptions for this Configuration.

All setters through this method are chainable.

Returns
Options for this configuration

Implements org.bukkit.configuration.Configuration.

Definition at line 153 of file YamlConfiguration.java.

153  {
154  if (options == null) {
155  options = new YamlConfigurationOptions(this);
156  }
157 
158  return (YamlConfigurationOptions) options;
159  }

The documentation for this class was generated from the following file: