Class Utils


  • public final class Utils
    extends java.lang.Object
    Reusable code snippets and constants.
    Since:
    5.1.2
    • Field Detail

      • INDEX_FILE_PREFIX

        public static final java.lang.String INDEX_FILE_PREFIX
        See Also:
        Constant Field Values
      • INDEX_DATE_FORMAT

        public static final java.text.DateFormat INDEX_DATE_FORMAT
      • FS_PATTERN

        public static final java.util.regex.Pattern FS_PATTERN
    • Constructor Detail

      • Utils

        private Utils()
    • Method Detail

      • loadProperties

        public static java.util.Properties loadProperties​(java.io.InputStream inputStream)
                                                   throws java.io.IOException
        Creates and loads Properties from provided InputStream and closes the stream.
        Throws:
        java.io.IOException
      • loadProperties

        public static java.util.Properties loadProperties​(ResourceHandler.Resource resource)
                                                   throws java.io.IOException
        Creates and loads Properties from provided ResourceHandler.Resource if exists, and closes the resource. If not exists, returns null.
        Throws:
        java.io.IOException
      • storeProperties

        public static void storeProperties​(java.io.OutputStream outputStream,
                                           java.util.Properties properties)
                                    throws java.io.IOException
        Saves Properties to provided OutputStream and closes the stream.
        Throws:
        java.io.IOException
      • allGroups

        public static Record allGroups​(java.util.Collection<java.lang.String> allGroups)
        Creates a record of type Record.Type.ALL_GROUPS.
      • rootGroups

        public static Record rootGroups​(java.util.Collection<java.lang.String> rootGroups)
        Creates a record of type Record.Type.ROOT_GROUPS.
      • renvl

        public static java.lang.String renvl​(java.lang.String v)
        Helper to translate the "NA" (not available) input into null value.
      • nvl

        public static java.lang.String nvl​(java.lang.String v)
        Helper to translate null into "NA" (not available) value.
      • rootGroup

        public static java.lang.String rootGroup​(java.lang.String groupId)
        Returns the "root group" of given groupId.