public final class Ini
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
Constructor and Description |
---|
Ini() |
Ini(byte[] aInibytes) |
Ini(java.lang.String pstrPathAndName)
Create a iniFile object from the file named in the parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addSection(java.lang.String header,
java.lang.String astrComments)
Sets the comments associated with a section.
|
java.lang.String[] |
getAllSectionNames()
Returns a string array containing names of all sections in INI file.
|
java.lang.Boolean |
getBooleanProperty(java.lang.String header,
java.lang.String property)
Returns the specified boolean property from the specified section.
|
boolean |
getBoolValue(java.lang.String header,
java.lang.String property)
Deprecated.
use getBooleanProperty()
|
java.util.Date |
getDateProperty(java.lang.String header,
java.lang.String property)
Returns the specified date property from the specified section.
|
java.lang.Double |
getDoubleProperty(java.lang.String header,
java.lang.String property)
Returns the specified double property from the specified section.
|
java.lang.String |
getFileName()
Returns the ini file name being used.
|
java.lang.Integer |
getIntegerProperty(java.lang.String header,
java.lang.String property)
Returns the specified integer property from the specified section.
|
int |
getIntValue(java.lang.String header,
java.lang.String property)
Deprecated.
use getIntegerProperty()
|
java.lang.Long |
getLongProperty(java.lang.String header,
java.lang.String property)
Returns the specified long property from the specified section.
|
long |
getLongValue(java.lang.String header,
java.lang.String property) |
java.util.Properties |
getProperties(java.lang.String header) |
java.util.Map<java.lang.String,tr.gov.tubitak.uekae.esya.api.common.tools.Ini.INIProperty> |
getPropertiesAsMap(java.lang.String header)
Returns a map containing all the properties under specified section.
|
java.lang.String[] |
getPropertyNames(java.lang.String header)
Returns a string array containing names of all the properties under specified section.
|
java.lang.String |
getStringProperty(java.lang.String header,
java.lang.String property)
Returns the specified string property from the specified section.
|
java.util.Date |
getTimestampProperty(java.lang.String header,
java.lang.String property)
Returns the specified date property from the specified section.
|
int |
getTotalSections() |
java.lang.String |
getValue(java.lang.String header,
java.lang.String property)
old style
|
void |
loadIni(java.lang.String pstrPathAndName) |
static void |
main(java.lang.String[] astrArgs)
The main entry point for testing.
|
void |
removeProperty(java.lang.String header,
java.lang.String property)
Removed specified property from the specified section.
|
void |
removeSection(java.lang.String header)
Removes the specified section if one exists, otherwise does nothing.
|
boolean |
save()
Flush changes back to the disk file.
|
void |
saveIni() |
void |
saveIni(java.lang.String file) |
void |
setBooleanProperty(java.lang.String header,
java.lang.String property,
boolean ablnVal,
java.lang.String astrComments)
Sets the specified boolean property.
|
void |
setDateFormat(java.lang.String astrDtFmt)
Sets the format to be used to interpreat date values.
|
void |
setDateProperty(java.lang.String header,
java.lang.String property,
java.util.Date adtVal,
java.lang.String astrComments)
Sets the specified java.util.Date property.
|
void |
setDoubleProperty(java.lang.String header,
java.lang.String property,
double adblVal,
java.lang.String astrComments)
Sets the specified double property.
|
void |
setIntegerProperty(java.lang.String header,
java.lang.String property,
int aintVal,
java.lang.String astrComments)
Sets the specified integer property.
|
void |
setLongProperty(java.lang.String header,
java.lang.String property,
long alngVal,
java.lang.String astrComments)
Sets the specified long property.
|
void |
setStringProperty(java.lang.String header,
java.lang.String property,
java.lang.String astrVal,
java.lang.String astrComments)
Sets the specified string property.
|
void |
setTimeStampFormat(java.lang.String astrTSFmt)
Sets the format to be used to interpreat timestamp values.
|
void |
setTimestampProperty(java.lang.String header,
java.lang.String property,
java.sql.Timestamp atsVal,
java.lang.String astrComments)
Sets the specified java.sql.Timestamp property.
|
void |
setValue(java.lang.String header,
java.lang.String property,
boolean value) |
void |
setValue(java.lang.String header,
java.lang.String property,
int value) |
void |
setValue(java.lang.String header,
java.lang.String property,
long value) |
void |
setValue(java.lang.String header,
java.lang.String property,
java.lang.String value) |
public Ini()
public Ini(byte[] aInibytes) throws java.io.IOException
java.io.IOException
public Ini(java.lang.String pstrPathAndName) throws java.io.IOException
pstrPathAndName
- The full path and name of the ini file to be used.java.io.IOException
public void loadIni(java.lang.String pstrPathAndName) throws java.io.IOException
java.io.IOException
public java.lang.String getFileName()
public java.lang.String getValue(java.lang.String header, java.lang.String property)
header
- property
- public java.lang.String getStringProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.@Deprecated public boolean getBoolValue(java.lang.String header, java.lang.String property)
header
- property
- public java.lang.Boolean getBooleanProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public int getIntValue(java.lang.String header, java.lang.String property)
header
- property
- public java.lang.Integer getIntegerProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public long getLongValue(java.lang.String header, java.lang.String property)
public java.lang.Long getLongProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public java.lang.Double getDoubleProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public java.util.Date getDateProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public java.util.Date getTimestampProperty(java.lang.String header, java.lang.String property)
header
- the INI section name.property
- the property to be retrieved.public void addSection(java.lang.String header, java.lang.String astrComments)
header
- the section nameastrComments
- the comments.public void setValue(java.lang.String header, java.lang.String property, boolean value)
public void setValue(java.lang.String header, java.lang.String property, int value)
public void setValue(java.lang.String header, java.lang.String property, long value)
public void setValue(java.lang.String header, java.lang.String property, java.lang.String value)
public void setStringProperty(java.lang.String header, java.lang.String property, java.lang.String astrVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.astrVal
- the property valueastrComments
- the property commentpublic void setBooleanProperty(java.lang.String header, java.lang.String property, boolean ablnVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.ablnVal
- the boolean value to be persistedpublic void setIntegerProperty(java.lang.String header, java.lang.String property, int aintVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.aintVal
- the int property to be persisted.public void setLongProperty(java.lang.String header, java.lang.String property, long alngVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.alngVal
- the long value to be persisted.public void setDoubleProperty(java.lang.String header, java.lang.String property, double adblVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.adblVal
- the double value to be persisted.public void setDateProperty(java.lang.String header, java.lang.String property, java.util.Date adtVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.adtVal
- the date value to be persisted.public void setTimestampProperty(java.lang.String header, java.lang.String property, java.sql.Timestamp atsVal, java.lang.String astrComments)
header
- the INI section name.property
- the property to be set.atsVal
- the timestamp value to be persisted.public void setDateFormat(java.lang.String astrDtFmt) throws java.lang.IllegalArgumentException
astrDtFmt
- the format stringjava.lang.IllegalArgumentException
- if the if the given pattern is invalidpublic void setTimeStampFormat(java.lang.String astrTSFmt)
astrTSFmt
- the format stringjava.lang.IllegalArgumentException
- if the if the given pattern is invalidpublic int getTotalSections()
public java.lang.String[] getAllSectionNames()
public java.lang.String[] getPropertyNames(java.lang.String header)
header
- the name of the section for which names of properties is to be retrieved.public java.util.Map<java.lang.String,tr.gov.tubitak.uekae.esya.api.common.tools.Ini.INIProperty> getPropertiesAsMap(java.lang.String header)
header
- the name of the section for which properties are to be retrieved.public java.util.Properties getProperties(java.lang.String header)
public void removeProperty(java.lang.String header, java.lang.String property)
header
- the section name.property
- the name of the property to be removed.public void removeSection(java.lang.String header)
header
- the name of the section to be removed.public void saveIni(java.lang.String file) throws java.io.IOException
java.io.IOException
public void saveIni() throws java.io.IOException
java.io.IOException
public boolean save() throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] astrArgs) throws java.io.IOException
astrArgs
- the command line arguments array if any.java.io.IOException
Copyright © 2025. All rights reserved.