| java.lang.Object java.io.File com.jat.core.config.CGIniFile
All known Subclasses: com.jat.core.config.Config,
CGIniFile | public class CGIniFile extends File (Code) | | Title: JAT
Description:
Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)
Distributed under the terms of the GNU Lesser General Public License, v2.1 or later
author: stf version: 1.0 |
Constructor Summary | |
public | CGIniFile(String _filename) Creates a new reference to an INI file. |
Method Summary | |
public void | addSection(String _sec) Creates a new section in the INI file. | public String | addValue(String _sec, String _key, String _value) Assigns a value to a key in a section of the INI file. | public boolean | existsSection(String _sec) Check if a section exists in the INI file. | public boolean | existsValue(String _sec, String _key) Return true if a section within the INI file contains the specified key. | public Hashtable | getAll() Allows the reading of the entire INI file.
The Hashtable containing the Hashtables for each section. | public String | getFilename() | public Hashtable | getSection(String _sec) Allows the reading of an entire section of configuration data. | public Vector | getSubKeys(String _section, String _keyPattern) Return a Vector of keys containing keyPattern
Parameters: _section - section name in the ini file Parameters: _keyPattern - pattern criteria throws: Exception - if an error occurs. | public Vector | getSubValues(String _section, String _keyPattern) Return a Vector of values containing keyPattern
Parameters: _section - section name in the ini file Parameters: _keyPattern - pattern criteria throws: Exception - if an error occurs. | public String | getValue(String _sec, String _key) Allows the reading of a single piece of configuration data from any section within the INI file. | public Hashtable | removeAll() Clears the entire INI file. | public void | removeKeys(String _sec, String _key) Removes all keys (and theirs corresponding values) starting with _key plus '.' from the INI file. | public Hashtable | removeSection(String _sec) Removes a section (and all it's keys) from the INI file.
Remember to save() when ready.
Any section removed as a Hashtable. | public String | removeValue(String _sec, String _key) Removes a key (and it's corresponding value) from the INI file.
Remember to save() when ready.
The value of any value that is removed. | public void | save() Writes out the current data to a file, overwriting the original file,
or the latest filename that it has been saved to successfully. | public void | save(String _filename) Writes out the current data to a file. | protected void | setAll(Hashtable _section) | protected static Vector | sort(Vector _tab) |
CGIniFile | public CGIniFile(String _filename) throws Exception(Code) | | Creates a new reference to an INI file. Reads in all the INI data.
Then , it closes the file.
This class should be fixed to allow more flexible parameters.
throws: Exception - if anything goes wrong during read. See Also: readSection |
addSection | public void addSection(String _sec)(Code) | | Creates a new section in the INI file.
If the section already exists or the section is null or "" then no action is taken.
Remember to save() when ready.
|
addValue | public String addValue(String _sec, String _key, String _value)(Code) | | Assigns a value to a key in a section of the INI file.
Any method calls where the section or key are null or zero length will be ignored.
Remember to save() when ready.
The value of any key that is overwritten in this operation. |
existsSection | public boolean existsSection(String _sec)(Code) | | Check if a section exists in the INI file.
true is section _sec exists, false otherwise |
existsValue | public boolean existsValue(String _sec, String _key)(Code) | | Return true if a section within the INI file contains the specified key.
boolean. |
getAll | public Hashtable getAll()(Code) | | Allows the reading of the entire INI file.
The Hashtable containing the Hashtables for each section. Will be empty if no sections exist. |
getSection | public Hashtable getSection(String _sec)(Code) | | Allows the reading of an entire section of configuration data.
The Hashtable containing the keys and values as strings in that section, null if the section does not exist. |
getSubKeys | public Vector getSubKeys(String _section, String _keyPattern) throws Exception(Code) | | Return a Vector of keys containing keyPattern
Parameters: _section - section name in the ini file Parameters: _keyPattern - pattern criteria throws: Exception - if an error occurs. Vector of keys |
getSubValues | public Vector getSubValues(String _section, String _keyPattern) throws Exception(Code) | | Return a Vector of values containing keyPattern
Parameters: _section - section name in the ini file Parameters: _keyPattern - pattern criteria throws: Exception - if an error occurs. Vector of values |
getValue | public String getValue(String _sec, String _key) throws Exception(Code) | | Allows the reading of a single piece of configuration data from any section within the INI file.
The string containing the value of the key. throws: Exception - |
removeAll | public Hashtable removeAll()(Code) | | Clears the entire INI file. Remember to save() when ready.
The Hashtable containing the Hashtables for each section. |
removeKeys | public void removeKeys(String _sec, String _key)(Code) | | Removes all keys (and theirs corresponding values) starting with _key plus '.' from the INI file.
Remember to save() when ready.
|
removeSection | public Hashtable removeSection(String _sec)(Code) | | Removes a section (and all it's keys) from the INI file.
Remember to save() when ready.
Any section removed as a Hashtable. Null if nothing is removed. |
removeValue | public String removeValue(String _sec, String _key)(Code) | | Removes a key (and it's corresponding value) from the INI file.
Remember to save() when ready.
The value of any value that is removed. Null if nothing is removed. |
save | public void save() throws IOException(Code) | | Writes out the current data to a file, overwriting the original file,
or the latest filename that it has been saved to successfully.
throws: IOException - if an error occurs while writing. |
sort | protected static Vector sort(Vector _tab)(Code) | | Sort Vector lexicalogicaly
Parameters: _tab - Vector to sort Sorted Vector |
|
|