Class fINI


  • public class fINI
    extends Object
    functions to manage INI Files
    • Field Detail

      • m_FileName

        public static String m_FileName
      • m_CommentStartMarker

        public static String m_CommentStartMarker
      • m_LineSeparator

        public static String m_LineSeparator
      • m_KeysToUpperCase

        public static boolean m_KeysToUpperCase
    • Constructor Detail

      • fINI

        public fINI()
    • 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        DefaultValue - 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 name
        KeyName - the key name
        booleanValue - the boolean value
        Comments - 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 name
        KeyName - the key name
        DateValue - the date value
        Comments - 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 name
        KeyName - the key name
        DoubleValue - the double value
        Comments - 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 name
        KeyName - the key name
        IntegerValue - the integer value
        Comments - 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 name
        KeyName - the key name
        LongValue - the long value
        Comments - the comments
      • wrNewSection

        public static void wrNewSection​(String SectionName,
                                        String Comments)
        writes a new section
        Parameters:
        SectionName - the section name
        Comments - 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 name
        Comments - 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 name
        KeyName - the key name
        StringValue - the string value
        Comments - 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 name
        KeyName - the key name
        TimestampValue - the timestamp value
        Comments - 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 name
        KeyName - 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
      • rdKeys

        public static Map<String,​db2000.J.eXtrafunctions.fINI.INIKey> rdKeys​(String SectionName)
        returns a map containing all the keys under specified section
        Parameters:
        SectionName - the name of the section for which properties are to be retrieved