public class CfgStrategy extends Object implements PersistenceStrategy
All values are stored as strings. The returned Dictionary
from read(InputStream)
will always consist of string values that must be separately parsed or
processed by the caller, even if they weren't strings when handed to write(OutputStream,
Dictionary)
.
Not recommended for use with complex objects such as arrays or maps. Where possible, use
.config and ConfigStrategy
instead.
STRATEGY_EXTENSION
Constructor and Description |
---|
CfgStrategy() |
Modifier and Type | Method and Description |
---|---|
String |
getExtension()
Gets the extension handled by this strategy.
|
Dictionary<String,Object> |
read(InputStream in)
Reads the configuration properties from an
InputStream . |
void |
write(OutputStream out,
Dictionary<String,Object> inputDictionary)
Writes the configuration properties to an
OutputStream . |
public String getExtension()
PersistenceStrategy
getExtension
in interface PersistenceStrategy
.
) handled by this strategypublic void write(OutputStream out, Dictionary<String,Object> inputDictionary) throws IOException
PersistenceStrategy
OutputStream
. The stream will not be
closed automatically.write
in interface PersistenceStrategy
out
- output stream where the properties will be writteninputDictionary
- properties to writeIOException
- thrown if the properties couldn't be writtenpublic Dictionary<String,Object> read(InputStream in) throws IOException
PersistenceStrategy
InputStream
. The stream will not be
closed automatically.read
in interface PersistenceStrategy
in
- input stream where the properties will be read fromIOException
- thrown if the properties couldn't be readThis work is licensed under a Creative Commons Attribution 4.0 International License.