|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.util.ini.IniSection
public class IniSection
This class defines an IniFile's section. It is a named portion of data
that is represented in a file like "[<section name>]" and contains
key names and key values pairs.
| Field Summary | |
|---|---|
static java.lang.String |
COMMENT_STRING
This is the string which appears in front of the comment lines. |
static java.lang.String |
KEY_COMMENT_STRING
This is the string which appears in front of the commented key-value lines. |
protected com.prosyst.util.ini.Queue |
keys
This Queue holds the keys. |
protected java.lang.String |
sectionName
This is the section's name as it appears in a file. |
protected com.prosyst.util.ini.Queue |
values
This Queue holds the correspondent values. |
| Constructor Summary | |
|---|---|
IniSection(java.lang.String sectionName)
Constructs a new IniSection. |
|
| Method Summary | |
|---|---|
void |
addComment(java.lang.String comment)
Appends a comment line. |
void |
addKey(java.lang.String key,
java.lang.String newValue)
Appends a new key name and key value to the section. |
void |
addString(java.lang.String line)
Appends a string which can be a null, "", comment, commented key, or a key-value pair. |
void |
commentKey(int index)
Comments a given key if it exists and is not already commented. |
void |
commentKey(java.lang.String key)
Comments a given key if it exists and is not already commented. |
boolean |
containsKey(java.lang.String key)
Returns true if the given key is defined in a section. |
void |
deleteKey(int index)
Deletes a key at the given index and its associated value from the section. |
void |
deleteKey(java.lang.String key)
Deletes a key and its associated value from the section. |
IniSection |
duplicate()
Returns a duplicate of this object. |
java.lang.String |
getKey(int index)
Returns a key name at a given index. |
int |
getKeyCount()
Returns the number of defined keys (or rows as displayed in a file) in this section. |
int |
getKeyIndex(java.lang.String key)
Returns the index of a key in this section. |
java.lang.String |
getName()
Returns the name of the section. |
java.lang.String |
getValue(int index)
Returns the key value at an index. |
java.lang.String |
getValue(java.lang.String key)
Returns the key value. |
java.lang.String |
indexToString(int index)
Returns the string representation of a key-value pair at the given index. |
void |
insertComment(int index,
java.lang.String comment)
Inserts a comment line. |
void |
insertKey(int index,
java.lang.String key,
java.lang.String value)
Inserts a new key at a given index. |
boolean |
isComment(int index)
Returns true if the key at the given index is actually a comment. |
boolean |
isCommentedKey(int index)
Returns true if the key at the given index is a commented key. |
boolean |
isCommentedKey(java.lang.String key)
Returns true if the given key is a commented key. |
void |
removeCommentedKeys()
Removes all commented keys. |
void |
removeComments()
Removes all comments. |
void |
setName(java.lang.String newName)
Sets the section's name. |
void |
setValue(java.lang.String key,
java.lang.String newValue)
Sets a new value of a key. |
java.lang.String |
toString()
|
void |
uncommentKey(int index)
Uncomments a given key if it exists and is commented. |
void |
uncommentKey(java.lang.String key)
Uncomments a given key if it exists and is commented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String KEY_COMMENT_STRING
public static final java.lang.String COMMENT_STRING
protected java.lang.String sectionName
protected com.prosyst.util.ini.Queue keys
Queue holds the keys.
protected com.prosyst.util.ini.Queue values
Queue holds the correspondent values.
| Constructor Detail |
|---|
public IniSection(java.lang.String sectionName)
IniSection.
sectionName - the new section's name| Method Detail |
|---|
public void addKey(java.lang.String key,
java.lang.String newValue)
key - new key namenewValue - new key valuepublic boolean containsKey(java.lang.String key)
true if the given key is defined in a section.
key - the key name to search for
true if it is defined in this section.public void deleteKey(int index)
index - index of a key to be deletedpublic void deleteKey(java.lang.String key)
key - a key to be deletedpublic int getKeyIndex(java.lang.String key)
key - key to be searched for
public java.lang.String getKey(int index)
index - key's index
public int getKeyCount()
public java.lang.String getValue(java.lang.String key)
key - key name
public java.lang.String getValue(int index)
index - index of a value
public java.lang.String getName()
public void insertKey(int index,
java.lang.String key,
java.lang.String value)
index - index at which to insert the new keykey - new key namevalue - new key valuepublic void setName(java.lang.String newName)
newName - new section's name
public void setValue(java.lang.String key,
java.lang.String newValue)
key - key to be updatednewValue - new key valuepublic void commentKey(java.lang.String key)
key - key to commentpublic void commentKey(int index)
index - index of the key to commentpublic void uncommentKey(java.lang.String key)
key - key to uncommentpublic void uncommentKey(int index)
index - index of the key to uncommentpublic void removeCommentedKeys()
public boolean isCommentedKey(int index)
index - key index
public boolean isCommentedKey(java.lang.String key)
key - key to test if it is commented
public void addComment(java.lang.String comment)
comment - comment to add
public void insertComment(int index,
java.lang.String comment)
index - index at which the comment will be insertedcomment - comment to addpublic void removeComments()
public boolean isComment(int index)
index - key index
public java.lang.String indexToString(int index)
index - key index
public void addString(java.lang.String line)
line - string representing the possible section datapublic IniSection duplicate()
public java.lang.String toString()
toString in class java.lang.Object
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||