public abstract class AbstractConfigurationLoader<NodeType extends ConfigurationNode> extends Object implements ConfigurationLoader<NodeType>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractConfigurationLoader.Builder<T extends AbstractConfigurationLoader.Builder> |
Modifier and Type | Field and Description |
---|---|
protected static String |
LINE_SEPARATOR |
protected static Splitter |
LINE_SPLITTER |
protected CharSource |
source |
static Charset |
UTF8_CHARSET |
Modifier | Constructor and Description |
---|---|
protected |
AbstractConfigurationLoader(CharSource source,
CharSink sink,
CommentHandler[] commentHandlers,
boolean preservesHeader) |
Modifier and Type | Method and Description |
---|---|
boolean |
canLoad() |
boolean |
canSave() |
CommentHandler |
getDefaultCommentHandler() |
NodeType |
load()
Create a new configuration node populated with the appropriate data
|
NodeType |
load(ConfigurationOptions options)
Create a new configuration node populated with the appropriate data, structured with the provided options
|
protected abstract void |
loadInternal(NodeType node,
BufferedReader reader) |
void |
save(ConfigurationNode node)
Save the contents of the given node tree to
|
protected abstract void |
saveInternal(ConfigurationNode node,
Writer writer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createEmptyNode
protected static final Splitter LINE_SPLITTER
protected static final String LINE_SEPARATOR
public static final Charset UTF8_CHARSET
protected final CharSource source
protected AbstractConfigurationLoader(CharSource source, CharSink sink, CommentHandler[] commentHandlers, boolean preservesHeader)
public CommentHandler getDefaultCommentHandler()
public NodeType load() throws IOException
ConfigurationLoader
load
in interface ConfigurationLoader<NodeType extends ConfigurationNode>
IOException
- if any sort of error occurs with reading or parsing the configurationpublic NodeType load(ConfigurationOptions options) throws IOException
ConfigurationLoader
load
in interface ConfigurationLoader<NodeType extends ConfigurationNode>
options
- The options to load withIOException
- if any sort of error occurs with reading or parsing the configurationprotected abstract void loadInternal(NodeType node, BufferedReader reader) throws IOException
IOException
public void save(ConfigurationNode node) throws IOException
ConfigurationLoader
save
in interface ConfigurationLoader<NodeType extends ConfigurationNode>
node
- The node a save is being requested forIOException
- if any sort of error occurs with writing or generating the configurationprotected abstract void saveInternal(ConfigurationNode node, Writer writer) throws IOException
IOException
public boolean canLoad()
public boolean canSave()
Copyright © 2014–2015 Leaping Ninja. All rights reserved.