|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--webfunds.ricardian.IniFileReader
This class handles files in the windows ini format
| Field Summary | |
protected static java.lang.String |
lastEoln
|
protected static java.lang.String |
lastErrors
|
protected static int |
numErrors
|
| Constructor Summary | |
IniFileReader()
Default constructor creates an empty IniFileReader |
|
IniFileReader(byte[] data)
read a ini formated file and put in the class |
|
| Method Summary | |
protected void |
add(byte[] iniFileAsByteArray)
Add a files worth to the hashtables. |
void |
addByteArray(byte[] data)
Add the contents of an ini-file formated byte array. |
void |
addMultilineSectionItem(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
This method can be used to add a item/value pair to a section using for mutliline |
void |
addSection(java.lang.String sectionName)
This method add a section to the IniFileReader class |
void |
addSectionItem(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
This method can be used to add a item/value pair to a section if the value is mutliline then you should use addMultilineSectionItem |
void |
changeSectionItemValue(java.lang.String sect,
java.lang.String item,
java.lang.String value)
This method can be used to change a value pair of a item in a section |
protected static void |
doLines(java.lang.String desc,
java.lang.String test)
|
void |
dump()
|
java.util.Hashtable |
getHashOfSectionItems(java.lang.String section)
This is used to get a Hashtable of the items in the specific section of the IniFileReader class |
java.util.Hashtable |
getIniFileHash()
|
static java.lang.String |
getLastErrors()
|
int |
getNumberOfSectionItems(java.lang.String section)
this is used for getting the amount of items in a section of a IniFileReader class |
int |
getNumberOfSections()
this method returns the number of sections in the IniFileReader class |
static int |
getNumErrors()
|
java.lang.String[] |
getSectionItemArray(java.lang.String sectionName,
java.lang.String item)
|
java.lang.Object |
getSectionItemObject(java.lang.String section,
java.lang.String item)
|
java.lang.String[] |
getSectionItems(java.lang.String section)
|
java.lang.String |
getSectionItemValue(java.lang.String section,
java.lang.String item)
Get an item from a section. |
java.lang.String[] |
getSectionNames()
|
java.util.Hashtable |
getWriteHashOfSectionItems(java.lang.String section)
This is used to get a Hashtable of the items in the specific section of the IniFileReader class for the purpose of adding or setting a new key. |
static void |
main(java.lang.String[] arg)
Test method requires a ini file called test.ini |
void |
removeSection(java.lang.String sectionName)
This method can be used to remove sections in the IniFileReader class |
void |
removeSectionItem(java.lang.String sectionName,
java.lang.String item)
This method can be used to remove an item form a section |
void |
removeSectionItemArray(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
|
byte[] |
saveToByteArray()
Make a windows ini-file-formatted representation of the data |
void |
saveToFile(java.lang.String fileName)
Save the IniFileReader contect to a file |
protected void |
startEmpty()
|
static void |
testLines()
|
static java.lang.String[] |
toLines(byte[] txt)
Take a byte array and turn it into an array of trimmed lines. |
static java.lang.String[] |
toLines(byte[] txt,
int version)
Take a byte array and turn it into an array of lines. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected static java.lang.String lastErrors
protected static java.lang.String lastEoln
protected static int numErrors
| Constructor Detail |
public IniFileReader()
public IniFileReader(byte[] data)
throws ContractException
iniFileAsByteArray - the byte array containing the ini file| Method Detail |
protected void startEmpty()
public void addByteArray(byte[] data)
throws ContractException
data - the byte array containing the additional ini filepublic static java.lang.String getLastErrors()
public static int getNumErrors()
public static java.lang.String[] toLines(byte[] txt)
public static java.lang.String[] toLines(byte[] txt,
int version)
If - version >= 3 then proper trim is used.
protected static void doLines(java.lang.String desc,
java.lang.String test)
public static void testLines()
protected void add(byte[] iniFileAsByteArray)
throws ContractException
public java.util.Hashtable getIniFileHash()
public byte[] saveToByteArray()
throws java.io.IOException
public void saveToFile(java.lang.String fileName)
throws java.io.IOException
fileName - the file name on wich to savepublic int getNumberOfSections()
public java.lang.String[] getSectionNames()
public void addSection(java.lang.String sectionName)
sectionName - the name of the new sectionpublic void removeSection(java.lang.String sectionName)
sectionName - the name of the section to removepublic int getNumberOfSectionItems(java.lang.String section)
section - section is an existing section on the ini filepublic java.util.Hashtable getWriteHashOfSectionItems(java.lang.String section)
section - section is an existing section on the ini filepublic java.util.Hashtable getHashOfSectionItems(java.lang.String section)
section - section is an existing section on the ini filepublic java.lang.String[] getSectionItems(java.lang.String section)
section - section is an existing section on the ini file
public java.lang.Object getSectionItemObject(java.lang.String section,
java.lang.String item)
public java.lang.String getSectionItemValue(java.lang.String section,
java.lang.String item)
section - is an existing section in the ini fileitem - is an existing item in the section in the ini file
public void addSectionItem(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
sectionName - the name of the sectionitem - the name of the item in the sectionvalue - the value of the item
public void addMultilineSectionItem(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
sectionName - the name of the sectionitem - the name of the item in the sectionvalue - the value of the item
public void changeSectionItemValue(java.lang.String sect,
java.lang.String item,
java.lang.String value)
sectionName - the name of the sectionitem - the name of the item in the sectionvalue - the value of the item
public void removeSectionItem(java.lang.String sectionName,
java.lang.String item)
sectionName - the name of the sectionitem - the name of the item to remove
public java.lang.String[] getSectionItemArray(java.lang.String sectionName,
java.lang.String item)
public void removeSectionItemArray(java.lang.String sectionName,
java.lang.String item,
java.lang.String value)
public void dump()
public static void main(java.lang.String[] arg)
throws java.io.IOException,
ContractException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||