Package ball.util
Class PropertiesImpl
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- ball.util.PropertiesImpl
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,Object>
public class PropertiesImpl extends Properties
Properties
implementation that overridesload(InputStream)
andstore(OutputStream,String)
methods to specify theCharset
(asUTF-8
).- Author:
- Allen D. Ball
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Charset
CHARSET
UTF-8-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description PropertiesImpl()
SeeProperties()
.PropertiesImpl(Properties defaults)
PropertiesImpl(Properties defaults, File file)
PropertiesImpl(Properties defaults, String resource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
configure(Object object)
static Object
configure(Properties properties, Object object)
Seeconfigure(Object)
.void
load(InputStream in)
protected static void
load(Properties properties, InputStream in)
void
store(OutputStream out, String comment)
protected static void
store(Properties properties, OutputStream out, String comment)
-
Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Constructor Detail
-
PropertiesImpl
public PropertiesImpl()
SeeProperties()
.
-
PropertiesImpl
public PropertiesImpl(Properties defaults)
- Parameters:
defaults
- AProperties
that contains default values for any keys not found in thisProperties
.
-
PropertiesImpl
public PropertiesImpl(Properties defaults, File file) throws IOException
- Parameters:
defaults
- The defaultProperties
.file
- TheFile
to load (may benull
).- Throws:
IOException
- Iffile
is not null and cannot be read.
-
PropertiesImpl
public PropertiesImpl(Properties defaults, String resource) throws IOException
- Parameters:
defaults
- The defaultProperties
.resource
- The name of theresource
to load (may benull
).- Throws:
IOException
- Ifresource
is not null and cannot be read.
-
-
Method Detail
-
configure
public Object configure(Object object) throws Exception
Method to configure anObject
properties with values inthis
PropertiesImpl
. (AnObject
"setter" does not have to returnvoid
to be invoked.)
-
load
public void load(InputStream in) throws IOException
- Overrides:
load
in classProperties
- Throws:
IOException
-
store
public void store(OutputStream out, String comment) throws IOException
- Overrides:
store
in classProperties
- Throws:
IOException
-
load
protected static void load(Properties properties, InputStream in) throws IOException
- Throws:
IOException
-
store
protected static void store(Properties properties, OutputStream out, String comment) throws IOException
- Throws:
IOException
-
configure
public static Object configure(Properties properties, Object object) throws Exception
Seeconfigure(Object)
.- Parameters:
properties
- TheProperties
with the configuration parameters..object
- TheObject
to configure.- Returns:
- The argument
Object
. - Throws:
Exception
- If any problem is encountered.
-
-