public class ResourceStreamPropertyIO extends AbstractPropertyIO
classLoader.getResourceAsStream()
. Thread.currentThread ().getContextClassLoader()
Thread.getContextClassLoader()
,
Serialized FormConstructor and Description |
---|
ResourceStreamPropertyIO(Class<?> clazz)
Constructor with a classname as the resource name.
|
ResourceStreamPropertyIO(String resourceName)
Constructor with a path and name of the resource.
|
Modifier and Type | Method and Description |
---|---|
String |
getName()
A short descriptive name of the Property IO.
|
Properties |
getProperties()
A convenience overload of that uses the current thread's context classloader.
|
String |
getResourceName()
The name of the resource.
|
String |
getSource()
A detailed description of the source of the property data.
|
void |
reload()
Reloads the name,value pairs for the PropertyIO, or forces the values to reload when read next time.
|
void |
setValue(String propertyName,
String value)
Sets the name,value as String in the IO.
|
void |
validate()
Fails validation if
ResourceName is null or empty.
Not able to getProperties(), it returns
null .
|
backup, getCacheTime, getLastLoaded, getLastSaved, getLogger, getTypedProperties, getTypedValue, getValue, isCached, isReadonly, logPerformanceGetProperties, logPerformanceSetValue, setCacheTime, storeTypedValue, updateLastLoaded, updateLastSaved, validateWritable
public ResourceStreamPropertyIO(String resourceName)
Thread.currentThread ().getContextClassLoader()
resourceName
- the resource name.public ResourceStreamPropertyIO(Class<?> clazz)
clazz
- the class to use for loadingNullPointerException
- if clazz is null
.public String getResourceName()
public String getName()
PropertyIO
public String getSource()
PropertyIO
public void setValue(String propertyName, String value) throws PropertyIOException
PropertyIO
propertyName
- the name of the propertyvalue
- the string value of the property.PropertyIOException
- if the IO is readonly or failed to write the value.public void validate() throws PropertyIOException
null
.PropertyIOException
public void reload()
PropertyIO
reload
in interface PropertyIO
reload
in class AbstractPropertyIO
public Properties getProperties()
ClassLoader loader = Thread.currentThread ().getContextClassLoader();
Properties