public final class ConfigurationFormats extends Object
ConfigurationFormat
instances.Modifier and Type | Method and Description |
---|---|
static List<ConfigurationFormat> |
getFormats()
Get all currently available formats, ordered by priority.
|
static List<ConfigurationFormat> |
getFormats(String... formatNames)
Get all currently available formats, ordered by priority.
|
static List<ConfigurationFormat> |
getFormats(URL url)
Get all currently available formats, ordered by priority.
|
static Collection<ConfigurationData> |
getPropertySources(Collection<URL> urls,
ConfigurationFormat... formats) |
static ConfigurationData |
readConfigurationData(String resource,
InputStream inputStream,
ConfigurationFormat... formats)
Tries to read configuration data from a given URL, hereby explicitly trying all given formats in order.
|
static ConfigurationData |
readConfigurationData(URL url)
Tries to read configuration data from a given URL, hereby traversing all known formats in order of precedence.
|
static ConfigurationData |
readConfigurationData(URL url,
ConfigurationFormat... formats)
Tries to read configuration data from a given URL, hereby explicitly trying all given formats in order.
|
public static List<ConfigurationFormat> getFormats()
public static List<ConfigurationFormat> getFormats(String... formatNames)
formatNames
- available formats to be ordered.public static List<ConfigurationFormat> getFormats(URL url)
url
- source to read configuration from.public static ConfigurationData readConfigurationData(URL url) throws IOException
url
- the url from where to read, not null.IOException
- if the resource cannot be read.public static ConfigurationData readConfigurationData(URL url, ConfigurationFormat... formats) throws IOException
url
- the url from where to read, not null.formats
- the formats to try.IOException
- if the resource cannot be read.public static Collection<ConfigurationData> getPropertySources(Collection<URL> urls, ConfigurationFormat... formats)
urls
- the urls from where to read, not null.formats
- the formats to try.ConfigurationData
of the files successfully decoded by the
given formats.public static ConfigurationData readConfigurationData(String resource, InputStream inputStream, ConfigurationFormat... formats) throws IOException
resource
- a descriptive name for the resource, since an InputStream does not have anyinputStream
- the inputStream from where to read, not null.formats
- the formats to try.IOException
- if the resource cannot be read.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.