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 Modifier and Type Class Description static class
XmlConfigurationLoader.Builder
Builds aXmlConfigurationLoader
.
-
Field Summary
-
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
CONFIGURATE_LINE_PATTERN, CONFIGURATE_LINE_SEPARATOR, sink, source, SYSTEM_LINE_SEPARATOR
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull XmlConfigurationLoader.Builder
builder()
Creates a newXmlConfigurationLoader
builder.AttributedConfigurationNode
createNode(ConfigurationOptions options)
Create an empty node with the provided options.@NonNull AttributedConfigurationNode
load(@NonNull ConfigurationOptions options)
Attempts to load aConfigurationNode
using this loader, from the defined source.protected void
loadInternal(AttributedConfigurationNode node, BufferedReader reader)
Using a created node, attempt to read a configuration file.protected void
saveInternal(ConfigurationNode node, Writer writer)
Perform a save of the node to the provided writer.protected void
writeHeaderInternal(Writer writer)
Write out any implementation-specific file header.-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
canLoad, canSave, checkCanWrite, defaultCommentHandler, defaultOptions, loadToReference, save
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.spongepowered.configurate.loader.ConfigurationLoader
load
-
Methods inherited from interface org.spongepowered.configurate.ConfigurationNodeFactory
createNode, createNode, createNode, toListCollector, toListCollector, toMapCollector, toMapCollector
-
-
-
-
Method Detail
-
builder
public static @NonNull XmlConfigurationLoader.Builder builder()
Creates a newXmlConfigurationLoader
builder.- Returns:
- a new builder
- Since:
- 4.0.0
-
load
public @NonNull AttributedConfigurationNode load(@NonNull ConfigurationOptions options) throws ParsingException
Description copied from interface:ConfigurationLoader
Attempts to load aConfigurationNode
using this loader, from the defined source.The resultant node represents the root of the configuration being loaded.
- Specified by:
load
in interfaceConfigurationLoader<AttributedConfigurationNode>
- Overrides:
load
in classAbstractConfigurationLoader<AttributedConfigurationNode>
- Parameters:
options
- the options to load with- Returns:
- the newly constructed node
- Throws:
ParsingException
-
loadInternal
protected void loadInternal(AttributedConfigurationNode node, BufferedReader reader)
Description copied from class:AbstractConfigurationLoader
Using a created node, attempt to read a configuration file.The header will already have been read if applicable.
- Specified by:
loadInternal
in classAbstractConfigurationLoader<AttributedConfigurationNode>
- Parameters:
node
- node to load intoreader
- reader to load from
-
writeHeaderInternal
protected void writeHeaderInternal(Writer writer) throws IOException
Description copied from class:AbstractConfigurationLoader
Write out any implementation-specific file header.- Overrides:
writeHeaderInternal
in classAbstractConfigurationLoader<AttributedConfigurationNode>
- Parameters:
writer
- writer to output to- Throws:
IOException
- if an error occurs in the implementation
-
saveInternal
protected void saveInternal(ConfigurationNode node, Writer writer) throws ConfigurateException
Description copied from class:AbstractConfigurationLoader
Perform a save of the node to the provided writer.- Specified by:
saveInternal
in classAbstractConfigurationLoader<AttributedConfigurationNode>
- Parameters:
node
- node to savewriter
- writer to output to- Throws:
ConfigurateException
- if any of the node's data is unsavable
-
createNode
public AttributedConfigurationNode createNode(ConfigurationOptions options)
Description copied from interface:ConfigurationNodeFactory
Create 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
-
-