Package db2000.J.eXtrafunctions
Class fINI
- java.lang.Object
-
- db2000.J.eXtrafunctions.fINI
-
public class fINI extends Object
functions to manage INI Files
-
-
Field Summary
Fields Modifier and Type Field Description static String
m_CommentStartMarker
static String
m_FileName
static boolean
m_KeysToUpperCase
static String
m_LineSeparator
-
Constructor Summary
Constructors Constructor Description fINI()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
GetCommentStartMarker()
returns the start-marker character used in commentsstatic String
GetDateFormat()
get the date format returns the DateFormat valuestatic String
GetFileName()
get the INI file name being used returns the INI file namestatic boolean
GetKeysToUpperCase()
get the uppercase status assigned to key names returns uppercase statusstatic String
GetLineSeparator()
returns the line separator currently in usestatic String
GetTimestampFormat()
get the timestamp format returns the TimestampFormat valuestatic Boolean
rdBoolean(String SectionName, String KeyName, Boolean DefaultValue)
returns the boolean value assigned to the specific section and keystatic Date
rdDate(String SectionName, String KeyName, Date DefaultValue)
returns the date value assigned to the specific section and keystatic Double
rdDouble(String SectionName, String KeyName, Double DefaultValue)
returns the double value assigned to the specific section and keystatic int
rdInteger(String SectionName, String KeyName, int DefaultValue)
returns the integer value assigned to the specific section and keystatic String[]
rdKeyNames(String SectionName)
returns a string array containing the names of all the keys under specified sectionstatic Map<String,db2000.J.eXtrafunctions.fINI.INIKey>
rdKeys(String SectionName)
returns a map containing all the keys under specified sectionstatic Long
rdLong(String SectionName, String KeyName, Long DefaultValue)
returns the long value assigned to the specific section and keystatic int
rdNumberSections()
returns the number of sections in INI filestatic db2000.J.eXtrafunctions.fINI.INISection
rdSection(String SectionName)
returns the named section or null if named section does not existsstatic String[]
rdSectionNames()
returns a string array containing the names of all sections in INI filestatic String
rdString(String SectionName, String KeyName, String DefaultValue)
returns the string value assigned to the specific section and keystatic Date
rdTimestamp(String SectionName, String KeyName, Date DefaultValue)
returns the timestamp value assigned to the specific section and keystatic void
rmKey(String SectionName, String KeyName)
remove the specified key from the specified sectionstatic void
rmSection(String SectionName)
remove the specified sectionstatic void
SetCommentStartMarker(String xStartMarker)
set the row start-marker character for commentsstatic void
SetDateFormat(String DateFormat)
set the date formatstatic void
SetFileName(String FileName)
set the INI file to usestatic void
SetKeysToUpperCase(boolean UpperCase)
set key names to uppercasestatic void
SetLineSeparator(String xLineSeparator)
set line separatorstatic void
SetTimestampFormat(String TimestampFormat)
set the timestamp formatstatic boolean
UpDate()
update the INI file, if the INI file does not exist it is createdstatic void
wrBoolean(String SectionName, String KeyName, boolean BooleanValue, String Comments)
write the boolean value to the specific section and keystatic void
wrDate(String SectionName, String KeyName, Date DateValue, String Comments)
write the date value to the specific section and keystatic void
wrDouble(String SectionName, String KeyName, double DoubleValue, String Comments)
write the double value to the specific section and keystatic void
wrInteger(String SectionName, String KeyName, int IntegerValue, String Comments)
write the integer value to the specific section and keystatic void
wrLong(String SectionName, String KeyName, long LongValue, String Comments)
write the long value to the specific section and keystatic void
wrNewSection(String SectionName, String Comments)
writes a new sectionstatic void
wrSection(String SectionName, String Comments)
write/update a comments associated with a section (if the section does not exist will be created)static void
wrString(String SectionName, String KeyName, String StringValue, String Comments)
write the string value to the specific section and keystatic void
wrTimestamp(String SectionName, String KeyName, Timestamp TimestampValue, String Comments)
write the timestamp value to the specific section and key
-
-
-
Method Detail
-
SetDateFormat
public static void SetDateFormat(String DateFormat)
set the date format- Parameters:
DateFormat
- the format string, if date format is not valid assumes by default "yyyy-MM-dd"
-
SetFileName
public static void SetFileName(String FileName)
set the INI file to use- Parameters:
FileName
- the full path and name of the INI file
-
SetCommentStartMarker
public static void SetCommentStartMarker(String xStartMarker)
set the row start-marker character for comments- Parameters:
xStartMarker
- = "#" (default) or ";", other characters are not allowed!
-
SetLineSeparator
public static void SetLineSeparator(String xLineSeparator)
set line separator- Parameters:
xLineSeparator
- = "\r", "\n", "\r\n\", Chr(13), Chr(10), Chr(13) + Chr(10), or other... (default will be the line separator used by the operating system)
-
SetKeysToUpperCase
public static void SetKeysToUpperCase(boolean UpperCase)
set key names to uppercase- Parameters:
UpperCase
- = 'True' (default) sets key names to uppercase, = 'False' no changes
-
SetTimestampFormat
public static void SetTimestampFormat(String TimestampFormat)
set the timestamp format- Parameters:
TimestampFormat
- the format string, if timestamp format is not valid assumes by default "yyyy-MM-dd"
-
GetDateFormat
public static String GetDateFormat()
get the date format returns the DateFormat value
-
GetFileName
public static String GetFileName()
get the INI file name being used returns the INI file name
-
GetCommentStartMarker
public static String GetCommentStartMarker()
returns the start-marker character used in comments
-
GetLineSeparator
public static String GetLineSeparator()
returns the line separator currently in use
-
GetKeysToUpperCase
public static boolean GetKeysToUpperCase()
get the uppercase status assigned to key names returns uppercase status
-
GetTimestampFormat
public static String GetTimestampFormat()
get the timestamp format returns the TimestampFormat value
-
rdBoolean
public static Boolean rdBoolean(String SectionName, String KeyName, Boolean DefaultValue)
returns the boolean value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdDate
public static Date rdDate(String SectionName, String KeyName, Date DefaultValue)
returns the date value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdDouble
public static Double rdDouble(String SectionName, String KeyName, Double DefaultValue)
returns the double value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdInteger
public static int rdInteger(String SectionName, String KeyName, int DefaultValue)
returns the integer value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdLong
public static Long rdLong(String SectionName, String KeyName, Long DefaultValue)
returns the long value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdSection
public static db2000.J.eXtrafunctions.fINI.INISection rdSection(String SectionName)
returns the named section or null if named section does not exists- Parameters:
SectionName
- the section name to be searched
-
rdString
public static String rdString(String SectionName, String KeyName, String DefaultValue)
returns the string value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
rdTimestamp
public static Date rdTimestamp(String SectionName, String KeyName, Date DefaultValue)
returns the timestamp value assigned to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDefaultValue
- the default value assigned is returned if the parameters are missing or not to find the key
-
wrBoolean
public static void wrBoolean(String SectionName, String KeyName, boolean BooleanValue, String Comments)
write the boolean value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key namebooleanValue
- the boolean valueComments
- the comments
-
wrDate
public static void wrDate(String SectionName, String KeyName, Date DateValue, String Comments)
write the date value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDateValue
- the date valueComments
- the comments
-
wrDouble
public static void wrDouble(String SectionName, String KeyName, double DoubleValue, String Comments)
write the double value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameDoubleValue
- the double valueComments
- the comments
-
wrInteger
public static void wrInteger(String SectionName, String KeyName, int IntegerValue, String Comments)
write the integer value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameIntegerValue
- the integer valueComments
- the comments
-
wrLong
public static void wrLong(String SectionName, String KeyName, long LongValue, String Comments)
write the long value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameLongValue
- the long valueComments
- the comments
-
wrNewSection
public static void wrNewSection(String SectionName, String Comments)
writes a new section- Parameters:
SectionName
- the section nameComments
- the comments
-
wrSection
public static void wrSection(String SectionName, String Comments)
write/update a comments associated with a section (if the section does not exist will be created)- Parameters:
SectionName
- the section nameComments
- the comments
-
wrString
public static void wrString(String SectionName, String KeyName, String StringValue, String Comments)
write the string value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameStringValue
- the string valueComments
- the comments
-
wrTimestamp
public static void wrTimestamp(String SectionName, String KeyName, Timestamp TimestampValue, String Comments)
write the timestamp value to the specific section and key- Parameters:
SectionName
- the section nameKeyName
- the key nameTimestampValue
- the timestamp valueComments
- the comments
-
UpDate
public static boolean UpDate()
update the INI file, if the INI file does not exist it is created
-
rmKey
public static void rmKey(String SectionName, String KeyName)
remove the specified key from the specified section- Parameters:
SectionName
- the section nameKeyName
- the key name
-
rmSection
public static void rmSection(String SectionName)
remove the specified section- Parameters:
SectionName
- the section name
-
rdNumberSections
public static int rdNumberSections()
returns the number of sections in INI file
-
rdSectionNames
public static String[] rdSectionNames()
returns a string array containing the names of all sections in INI file
-
rdKeyNames
public static String[] rdKeyNames(String SectionName)
returns a string array containing the names of all the keys under specified section- Parameters:
SectionName
- the name of the section for which names of properties is to be retrieved
-
-