Class PropertiesLoaderUtils


  • public class PropertiesLoaderUtils
    extends java.lang.Object
    Convenient utility methods for loading of java.util.Properties, performing standard handling of input streams.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void fillProperties​(java.util.Properties props, java.lang.String resourceName)
      Fill the given properties from the specified class path resource (in ISO-8859-1 encoding).
      static void fillProperties​(java.util.Properties props, java.lang.String resourceName, java.lang.ClassLoader classLoader)
      Fill the given properties from the specified class path resource (in ISO-8859-1 encoding).
      static java.util.Properties loadProperties​(java.lang.String resourceName)
      Load all properties from the specified class path resource (in ISO-8859-1 encoding), using the default class loader.
      static java.util.Properties loadProperties​(java.lang.String resourceName, java.lang.ClassLoader classLoader)
      Load all properties from the specified class path resource (in ISO-8859-1 encoding), using the given class loader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertiesLoaderUtils

        public PropertiesLoaderUtils()
    • Method Detail

      • loadProperties

        public static java.util.Properties loadProperties​(java.lang.String resourceName)
                                                   throws java.io.IOException
        Load all properties from the specified class path resource (in ISO-8859-1 encoding), using the default class loader.

        Merges properties if more than one resource of the same name found in the class path.

        Parameters:
        resourceName - the name of the class path resource
        Returns:
        the Properties instance
        Throws:
        java.io.IOException - if loading failed
      • loadProperties

        public static java.util.Properties loadProperties​(java.lang.String resourceName,
                                                          java.lang.ClassLoader classLoader)
                                                   throws java.io.IOException
        Load all properties from the specified class path resource (in ISO-8859-1 encoding), using the given class loader.

        Merges properties if more than one resource of the same name found in the class path.

        Parameters:
        resourceName - the name of the class path resource
        classLoader - the class loader
        Returns:
        the Properties instance
        Throws:
        java.io.IOException - if loading failed
      • fillProperties

        public static void fillProperties​(java.util.Properties props,
                                          java.lang.String resourceName)
                                   throws java.io.IOException
        Fill the given properties from the specified class path resource (in ISO-8859-1 encoding).

        Merges properties if more than one resource of the same name found in the class path.

        Parameters:
        props - the Properties instance to load into
        resourceName - the name of the class path resource
        Throws:
        java.io.IOException - if loading failed
      • fillProperties

        public static void fillProperties​(java.util.Properties props,
                                          java.lang.String resourceName,
                                          java.lang.ClassLoader classLoader)
                                   throws java.io.IOException
        Fill the given properties from the specified class path resource (in ISO-8859-1 encoding).

        Merges properties if more than one resource of the same name found in the class path.

        Parameters:
        props - the Properties instance to load into
        resourceName - the name of the class path resource
        classLoader - the class loader
        Throws:
        java.io.IOException - if loading failed