类 FileConfiguration
- 所有已实现的接口:
Configuration,ConfigurationSection
- 直接已知子类:
YamlConfiguration
Configuration 的配置文件的基类-
字段概要
从类继承的字段 org.bukkit.configuration.MemoryConfiguration
defaults, options从类继承的字段 org.bukkit.configuration.MemorySection
map -
构造器概要
构造器构造器说明创建一个空的,没有值默认值的FileConfiguration.FileConfiguration(@Nullable Configuration defaults) 创建一个空的FileConfiguration并且使用Configuration内的所有默认值创建它. -
方法概要
修饰符和类型方法说明已过时。此方法仅为向后兼容而存在.它不会执行任何操作,请勿使用!void从指定位置加载FileConfiguration.void从指定的读取器加载此FileConfiguration.void从指定位置加载FileConfiguration.abstract voidloadFromString(@NotNull String contents) 从指定的字符串加载此FileConfiguration,而不是从文件加载.options()获取这个Configuration的ConfigurationOptions.void以一个FileConfiguration调用该方法,将文件储存到指定位置.void以一个FileConfiguration调用该方法,将文件储存到指定位置.将这个FileConfiguration转化为String对象并且返回从类继承的方法 org.bukkit.configuration.MemoryConfiguration
addDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaults从类继承的方法 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从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 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
-
构造器详细资料
-
FileConfiguration
public FileConfiguration()创建一个空的,没有值默认值的FileConfiguration. -
FileConfiguration
创建一个空的FileConfiguration并且使用Configuration内的所有默认值创建它.- 参数:
defaults- 为其创建提供缺省值的Configuration.
-
-
方法详细资料
-
save
以一个FileConfiguration调用该方法,将文件储存到指定位置.如果你指定储存的这个文件不存在,这个方法会帮你自动创建一个. 如果这个文件存在,那么该方法会把所有未保存的更改直接写入文件 并且直接覆盖原文件. 如果储存或者创建失败,将会抛出一个异常
本方法会用系统默认的编码储存,不过也有可能用UTF-8出储存
- 参数:
file- 要储存的文件- 抛出:
IOException- 然后会给出无法创建或者保存的原因.IllegalArgumentException- 如果文件为空,抛出该异常
-
save
以一个FileConfiguration调用该方法,将文件储存到指定位置.如果你指定储存的这个文件不存在,这个方法会帮你自动创建一个. 如果这个文件存在,那么该方法会把所有未保存的更改直接写入文件 并且直接覆盖原文件. 如果储存或者创建失败,将会抛出一个异常
本方法会用系统默认的编码储存,不过也有可能用UTF-8出储存
- 参数:
file- 要储存的文件- 抛出:
IOException- 然后会给出无法创建或者保存的原因.IllegalArgumentException- 如果文件为空,泡出该异常
-
saveToString
将这个FileConfiguration转化为String对象并且返回- 返回:
- 这个FileConfiguration包含的所有String
-
load
public void load(@NotNull @NotNull File file) throws FileNotFoundException, IOException, InvalidConfigurationException 从指定位置加载FileConfiguration.此配置中包含的所有值都将被移除,只保留设置和默认值,新的值将从给定的文件中加载.
如果文件因任何原因无法加载,将会抛出异常.
原文:Load from the specified 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 file. If the file cannot be loaded for any reason, an exception will be thrown.
- 参数:
file- 要加载的文件- 抛出:
FileNotFoundException- 当给定的文件无法被打开时抛出IOException- 当给定的文件无法被读取时抛出InvalidConfigurationException- 当给定的文件不是有效的配置时抛出IllegalArgumentException- 当文件为null时抛出
-
load
从指定的读取器加载此FileConfiguration.此配置中包含的所有值都将被移除,只保留设置和默认值,新的值将从给定的流中加载.
原文:Loads this 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- 要从中加载的读取器- 抛出:
IOException- 当底层读取器抛出IOException时抛出InvalidConfigurationException- 当读取器不表示有效的配置时抛出IllegalArgumentException- 当reader为null时抛出
-
load
public void load(@NotNull @NotNull String file) throws FileNotFoundException, IOException, InvalidConfigurationException 从指定位置加载FileConfiguration.此配置中包含的所有值都将被移除,只保留设置和默认值,新的值将从给定的文件中加载.
如果文件因任何原因无法加载,将会抛出异常.
原文:Loads this 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- 要加载的文件- 抛出:
FileNotFoundException- 当给定的文件无法被打开时抛出IOException- 当给定的文件无法被读取时抛出InvalidConfigurationException- 当给定的文件不是有效的配置时抛出IllegalArgumentException- 当文件为null时抛出
-
loadFromString
public abstract void loadFromString(@NotNull @NotNull String contents) throws InvalidConfigurationException 从指定的字符串加载此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.
- 参数:
contents- 要加载的配置内容- 抛出:
InvalidConfigurationException- 如果指定的字符串无效则抛出IllegalArgumentException- 如果contents为null则抛出
-
buildHeader
已过时。此方法仅为向后兼容而存在.它不会执行任何操作,请勿使用!请使用FileConfigurationOptions.getHeader()代替.- 返回:
- 空白字符串
-
options
从接口复制的说明:Configuration获取这个Configuration的ConfigurationOptions.如需修改配置,直接修改返回值即可.
原文: Gets the
ConfigurationOptionsfor thisConfiguration.All setters through this method are chainable.
- 指定者:
options在接口中Configuration- 覆盖:
options在类中MemoryConfiguration- 返回:
- 这个配置文件的一些配置(格式之类的).
-