|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bukkit.configuration.MemorySection org.bukkit.configuration.MemoryConfiguration org.bukkit.configuration.file.FileConfiguration
public abstract class FileConfiguration
This is a base class for all File based implementations of Configuration
Field Summary | |
---|---|
static boolean |
SYSTEM_UTF
Deprecated. temporary compatibility measure |
static boolean |
UTF_BIG
Deprecated. temporary compatibility measure |
static boolean |
UTF8_OVERRIDE
Deprecated. temporary compatibility measure |
Fields inherited from class org.bukkit.configuration.MemoryConfiguration |
---|
defaults, options |
Fields inherited from class org.bukkit.configuration.MemorySection |
---|
map |
Constructor Summary | |
---|---|
FileConfiguration()
Creates an empty FileConfiguration with no default values. |
|
FileConfiguration(Configuration defaults)
Creates an empty FileConfiguration using the specified Configuration as a source for all default values. |
Method Summary | |
---|---|
protected abstract String |
buildHeader()
Compiles the header for this FileConfiguration and returns the
result. |
void |
load(File file)
Loads this FileConfiguration from the specified location. |
void |
load(InputStream stream)
Deprecated. This does not consider encoding |
void |
load(Reader reader)
Loads this FileConfiguration from the specified reader. |
void |
load(String file)
Loads this FileConfiguration from the specified location. |
abstract void |
loadFromString(String contents)
Loads this FileConfiguration from the specified string, as
opposed to from file. |
FileConfigurationOptions |
options()
Gets the ConfigurationOptions for this Configuration . |
void |
save(File file)
Saves this FileConfiguration to the specified location. |
void |
save(String file)
Saves this FileConfiguration to the specified location. |
abstract String |
saveToString()
Saves this FileConfiguration to a string, and returns it. |
Methods inherited from class org.bukkit.configuration.MemoryConfiguration |
---|
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults |
Methods inherited from class org.bukkit.configuration.MemorySection |
---|
contains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, set, 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, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getItemStack, getItemStack, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isSet, isString, isVector, set |
Field Detail |
---|
@Deprecated public static final boolean UTF8_OVERRIDE
@Deprecated public static final boolean UTF_BIG
@Deprecated public static final boolean SYSTEM_UTF
Constructor Detail |
---|
public FileConfiguration()
FileConfiguration
with no default values.
public FileConfiguration(Configuration defaults)
FileConfiguration
using the specified Configuration
as a source for all default values.
defaults
- Default value providerMethod Detail |
---|
public void save(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(String 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 abstract String saveToString()
FileConfiguration
to a string, and returns it.
public void load(File file) 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.
This will attempt to use the Charset.defaultCharset()
for
files, unless UTF8_OVERRIDE
but not UTF_BIG
is
specified.
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.@Deprecated public void load(InputStream stream) throws IOException, InvalidConfigurationException
FileConfiguration
from the specified stream.
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.
This will attempt to use the Charset.defaultCharset()
, unless
UTF8_OVERRIDE
or UTF_BIG
is specified.
stream
- Stream to load from
IOException
- Thrown when the given file cannot be read.
InvalidConfigurationException
- Thrown when the given file is not
a valid Configuration.
IllegalArgumentException
- Thrown when stream is null.load(Reader)
public void load(Reader reader) throws 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 from
IOException
- thrown when underlying reader throws an IOException
InvalidConfigurationException
- thrown when the reader does not
represent a valid Configuration
IllegalArgumentException
- thrown when reader is nullpublic void load(String file) 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(String contents) 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.protected abstract String buildHeader()
FileConfiguration
and returns the
result.
This will use the header from options()
-> FileConfigurationOptions.header()
, respecting the rules of FileConfigurationOptions.copyHeader()
if set.
public FileConfigurationOptions options()
Configuration
ConfigurationOptions
for this Configuration
.
All setters through this method are chainable.
options
in interface Configuration
options
in class MemoryConfiguration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |