railo.commons.io.ini
Class IniFile

java.lang.Object
  extended by railo.commons.io.ini.IniFile

public final class IniFile
extends Object

read a ini file and allow to modifie and read the data


Constructor Summary
IniFile(InputStream is)
           
IniFile(Resource file)
          Constructor for the IniFile object
 
Method Summary
 String getKeyValue(String strSection, String key)
          Gets the KeyValue attribute of the IniFile object
 String getKeyValueEL(String strSection, String key)
          Gets the KeyValue attribute of the IniFile object, if not exist return null
static Struct getProfileSections(Resource file)
           
 Map getSection(String strSection)
          Gets the Section attribute of the IniFile object
 Map getSectionEL(String strSection)
          Gets the Section attribute of the IniFile object, return null if section not exist
 Map getSections()
          Gets the Sections attribute of the IniFile object
 boolean isNullOrEmpty(String section, String key)
          Gets the NullOrEmpty attribute of the IniFile object
 void load(InputStream in)
          loads the ini file
 void removeSection(String strSection)
          removes a selection
 void save()
          save back content to ini file
 void setKeyValue(String strSection, String key, String value)
          Sets the KeyValue attribute of the IniFile object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IniFile

public IniFile(Resource file)
        throws IOException
Constructor for the IniFile object

Parameters:
file - ini FIle
Throws:
IOException

IniFile

public IniFile(InputStream is)
        throws IOException
Throws:
IOException
Method Detail

setKeyValue

public void setKeyValue(String strSection,
                        String key,
                        String value)
Sets the KeyValue attribute of the IniFile object

Parameters:
strSection - the section to set
key - the key of the new value
value - the value to set

getSections

public Map getSections()
Gets the Sections attribute of the IniFile object

Returns:
The Sections value

getSection

public Map getSection(String strSection)
               throws IOException
Gets the Section attribute of the IniFile object

Parameters:
strSection - section name to get
Returns:
The Section value
Throws:
IOException

getSectionEL

public Map getSectionEL(String strSection)
Gets the Section attribute of the IniFile object, return null if section not exist

Parameters:
strSection - section name to get
Returns:
The Section value

isNullOrEmpty

public boolean isNullOrEmpty(String section,
                             String key)
Gets the NullOrEmpty attribute of the IniFile object

Parameters:
section - section to check
key - key to check
Returns:
is empty or not

getKeyValue

public String getKeyValue(String strSection,
                          String key)
                   throws IOException
Gets the KeyValue attribute of the IniFile object

Parameters:
strSection - section to get
key - key to get
Returns:
matching alue
Throws:
IOException

getKeyValueEL

public String getKeyValueEL(String strSection,
                            String key)
Gets the KeyValue attribute of the IniFile object, if not exist return null

Parameters:
strSection - section to get
key - key to get
Returns:
matching alue

load

public void load(InputStream in)
          throws IOException
loads the ini file

Parameters:
in - inputstream to read
Throws:
IOException

save

public void save()
          throws IOException
save back content to ini file

Throws:
IOException

removeSection

public void removeSection(String strSection)
removes a selection

Parameters:
strSection - section to remove

getProfileSections

public static Struct getProfileSections(Resource file)
                                 throws IOException
Parameters:
file -
Returns:
return a struct with all section an dkey list as value
Throws:
IOException


Copyright © 2012 Railo