Class XmlConfigurationLoader
java.lang.Object
org.spongepowered.configurate.loader.AbstractConfigurationLoader<AttributedConfigurationNode>
org.spongepowered.configurate.xml.XmlConfigurationLoader
- All Implemented Interfaces:
ConfigurationNodeFactory<AttributedConfigurationNode>,ConfigurationLoader<AttributedConfigurationNode>
public final class XmlConfigurationLoader
extends AbstractConfigurationLoader<AttributedConfigurationNode>
A loader for XML (Extensible Markup Language), using the native javax library
for parsing and generation.
- Since:
- 4.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
CONFIGURATE_LINE_PATTERN, CONFIGURATE_LINE_SEPARATOR, sink, source, SYSTEM_LINE_SEPARATOR -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull XmlConfigurationLoader.Builderbuilder()Creates a newXmlConfigurationLoaderbuilder.createNode(ConfigurationOptions options) Create an empty node with the provided options.@NonNull AttributedConfigurationNodeload(@NonNull ConfigurationOptions options) Attempts to load aConfigurationNodeusing this loader, from the defined source.protected voidloadInternal(AttributedConfigurationNode node, BufferedReader reader) Using a created node, attempt to read a configuration file.protected voidsaveInternal(ConfigurationNode node, Writer writer) Perform a save of the node to the provided writer.protected voidwriteHeaderInternal(Writer writer) Write out any implementation-specific file header.Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
canLoad, canSave, checkCanWrite, defaultCommentHandler, defaultOptions, loadToReference, saveMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.spongepowered.configurate.loader.ConfigurationLoader
loadMethods inherited from interface org.spongepowered.configurate.ConfigurationNodeFactory
createNode, createNode, createNode, toListCollector, toListCollector, toMapCollector, toMapCollector
-
Method Details
-
builder
Creates a newXmlConfigurationLoaderbuilder.- Returns:
- a new builder
- Since:
- 4.0.0
-
load
public @NonNull AttributedConfigurationNode load(@NonNull ConfigurationOptions options) throws ParsingException Description copied from interface:ConfigurationLoaderAttempts to load aConfigurationNodeusing this loader, from the defined source.The resultant node represents the root of the configuration being loaded.
- Specified by:
loadin interfaceConfigurationLoader<AttributedConfigurationNode>- Overrides:
loadin classAbstractConfigurationLoader<AttributedConfigurationNode>- Parameters:
options- the options to load with- Returns:
- the newly constructed node
- Throws:
ParsingException
-
loadInternal
Description copied from class:AbstractConfigurationLoaderUsing a created node, attempt to read a configuration file.The header will already have been read if applicable.
- Specified by:
loadInternalin classAbstractConfigurationLoader<AttributedConfigurationNode>- Parameters:
node- node to load intoreader- reader to load from
-
writeHeaderInternal
Description copied from class:AbstractConfigurationLoaderWrite out any implementation-specific file header.- Overrides:
writeHeaderInternalin classAbstractConfigurationLoader<AttributedConfigurationNode>- Parameters:
writer- writer to output to- Throws:
IOException- if an error occurs in the implementation
-
saveInternal
Description copied from class:AbstractConfigurationLoaderPerform a save of the node to the provided writer.- Specified by:
saveInternalin classAbstractConfigurationLoader<AttributedConfigurationNode>- Parameters:
node- node to savewriter- writer to output to- Throws:
ConfigurateException- if any of the node's data is unsavable
-
createNode
Description copied from interface:ConfigurationNodeFactoryCreate an empty node with the provided options.Node options may be overridden if the factory enforces specific requirements on options.
- Parameters:
options- node options- Returns:
- newly created empty node
-