Class PropertyUtils


  • public class PropertyUtils
    extends java.lang.Object
    Static utility methods for loading properties.
    • Constructor Detail

      • PropertyUtils

        @Deprecated
        public PropertyUtils()
        Deprecated.
        This is a utility class with only static methods. Don't create instances of it.
        The constructor.
    • Method Detail

      • loadProperties

        @Deprecated
        public static java.util.Properties loadProperties​(java.net.URL url)
        Deprecated.
        use loadOptionalProperties(java.net.URL) instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returns null instead of an empty Properties instance when the given URL is null.
        Parameters:
        url - the URL which should be used to load the properties
        Returns:
        the loaded properties
      • loadProperties

        @Deprecated
        public static java.util.Properties loadProperties​(java.io.File file)
        Deprecated.
        use loadOptionalProperties(java.io.File) instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returns null instead of an empty Properties instance when the given File is null.
        Parameters:
        file - the file from which the properties will be loaded
        Returns:
        the loaded properties
      • loadProperties

        @Deprecated
        public static java.util.Properties loadProperties​(java.io.InputStream is)
        Deprecated.
        use loadOptionalProperties(java.io.InputStream) instead. This method should not be used as it suppresses exceptions silently when loading properties fails.
        Loads Properties from an InputStream and closes the stream. In a future release, this will no longer close the stream, so callers should close the stream themselves.
        Parameters:
        is - InputStream
        Returns:
        the loaded properties
      • loadOptionalProperties

        public static java.util.Properties loadOptionalProperties​(java.net.URL url)
        Loads Properties from a given URL.

        If the given URL is null or the properties can't be read, an empty properties object is returned.

        Parameters:
        url - the URL of the properties resource to load or null
        Returns:
        the loaded properties or an empty Properties instance if properties fail to load
        Since:
        3.1.0
      • loadOptionalProperties

        public static java.util.Properties loadOptionalProperties​(java.io.File file)
        Loads Properties from a File.

        If the given File is null or the properties file can't be read, an empty properties object is returned.

        Parameters:
        file - the File of the properties resource to load or null
        Returns:
        the loaded properties or an empty Properties instance if properties fail to load
        Since:
        3.1.0
      • loadOptionalProperties

        public static java.util.Properties loadOptionalProperties​(java.io.InputStream inputStream)
        Loads Properties from an InputStream and closes the stream. If the given InputStream is null or the properties can't be read, an empty properties object is returned. In a future release, this will no longer close the stream, so callers should close the stream themselves.
        Parameters:
        inputStream - the properties resource to load or null
        Returns:
        the loaded properties or an empty Properties instance if properties fail to load
        Since:
        3.1.0