Package org.apache.maven.shared.utils
Class PropertyUtils
- java.lang.Object
-
- org.apache.maven.shared.utils.PropertyUtils
-
public class PropertyUtils extends java.lang.Object
Static utility methods for loading properties.
-
-
Constructor Summary
Constructors Constructor Description PropertyUtils()
Deprecated.This is a utility class with only static methods.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.util.Properties
loadOptionalProperties(java.io.File file)
LoadsProperties
from aFile
.static java.util.Properties
loadOptionalProperties(java.io.InputStream inputStream)
LoadsProperties
from anInputStream
and closes the stream.static java.util.Properties
loadOptionalProperties(java.net.URL url)
LoadsProperties
from a givenURL
.static java.util.Properties
loadProperties(java.io.File file)
Deprecated.useloadOptionalProperties(java.io.File)
instead.static java.util.Properties
loadProperties(java.io.InputStream is)
Deprecated.useloadOptionalProperties(java.io.InputStream)
instead.static java.util.Properties
loadProperties(java.net.URL url)
Deprecated.useloadOptionalProperties(java.net.URL)
instead.
-
-
-
Method Detail
-
loadProperties
@Deprecated public static java.util.Properties loadProperties(@Nonnull java.net.URL url)
Deprecated.useloadOptionalProperties(java.net.URL)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returnsnull
instead of an emptyProperties
instance when the givenURL
isnull
.- Parameters:
url
- the URL which should be used to load the properties- Returns:
- the loaded properties
-
loadProperties
@Deprecated public static java.util.Properties loadProperties(@Nonnull java.io.File file)
Deprecated.useloadOptionalProperties(java.io.File)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails and returnsnull
instead of an emptyProperties
instance when the givenFile
isnull
.- Parameters:
file
- the file from which the properties will be loaded- Returns:
- the loaded properties
-
loadProperties
@Deprecated public static java.util.Properties loadProperties(@Nullable java.io.InputStream is)
Deprecated.useloadOptionalProperties(java.io.InputStream)
instead. This method should not be used as it suppresses exceptions silently when loading properties fails.LoadsProperties
from anInputStream
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
@Nonnull public static java.util.Properties loadOptionalProperties(@Nullable java.net.URL url)
LoadsProperties
from a givenURL
.If the given
URL
isnull
or the properties can't be read, an empty properties object is returned.- Parameters:
url
- theURL
of the properties resource to load ornull
- Returns:
- the loaded properties or an empty
Properties
instance if properties fail to load - Since:
- 3.1.0
-
loadOptionalProperties
@Nonnull public static java.util.Properties loadOptionalProperties(@Nullable java.io.File file)
LoadsProperties
from aFile
.If the given
File
isnull
or the properties file can't be read, an empty properties object is returned.- Parameters:
file
- theFile
of the properties resource to load ornull
- Returns:
- the loaded properties or an empty
Properties
instance if properties fail to load - Since:
- 3.1.0
-
loadOptionalProperties
@Nonnull public static java.util.Properties loadOptionalProperties(@Nullable java.io.InputStream inputStream)
LoadsProperties
from anInputStream
and closes the stream. If the givenInputStream
isnull
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 ornull
- Returns:
- the loaded properties or an empty
Properties
instance if properties fail to load - Since:
- 3.1.0
-
-