org.nuiton.wikitty.publication
Class PropertiesExtended

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.nuiton.wikitty.publication.PropertiesExtended
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class PropertiesExtended
extends Properties

Class usefull when load properties file, update, delete, then save again File used to load properties is store, and this allow to save again the properties inside the file used to load them.

Author:
mfortun
See Also:
Serialized Form

Field Summary
protected  File origin
          The original file used to load and create properties
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PropertiesExtended(File origin)
          Default constructor, need a file from whom load the properties.
 
Method Summary
 File getOrigin()
           
 void load(File file)
          Load the property from the file, and store the file, for storage.
 void setOrigin(File origin)
           
 void store()
          Store the properties inside the last file used to load the property (or by default file used to create the class), equivalent of store(new FileWriter('File'),"");
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

origin

protected File origin
The original file used to load and create properties

Constructor Detail

PropertiesExtended

public PropertiesExtended(File origin)
                   throws IOException
Default constructor, need a file from whom load the properties. This is equivalent of a basic creation of properties and load after property from a file.

Parameters:
origin - the file from whom load the property, it is save for store.
Throws:
IOException - if error while reading the file
FileNotFoundException - if file not found
Method Detail

getOrigin

public File getOrigin()

setOrigin

public void setOrigin(File origin)

load

public void load(File file)
          throws IOException
Load the property from the file, and store the file, for storage.

Parameters:
file - the file from whom to load the property, it replace the file use to create this class
Throws:
IOException - if error while reading the file
FileNotFoundException - if file not found

store

public void store()
           throws IOException
Store the properties inside the last file used to load the property (or by default file used to create the class), equivalent of store(new FileWriter('File'),"");

Throws:
IOException - if error while reading the file
FileNotFoundException - if file not found


Copyright © 2010-2011 CodeLutin. All Rights Reserved.