Example usage for Java org.apache.hadoop.conf Configuration fields, constructors, methods, implement or subclass
The text is from its open source code.
Configuration() A new configuration. | |
Configuration(boolean loadDefaults) A new configuration where the behavior of reading from the default resources can be turned off. | |
Configuration(Configuration other) A new configuration with the same settings cloned from another. |
void | addDefaultResource(String name) Add a default resource. |
void | addDeprecation(String key, String[] newKeys) Adds the deprecated key to the global deprecation map when no custom message is provided. |
void | addDeprecation(String key, String newKey) Adds the deprecated key to the global deprecation map when no custom message is provided. |
void | addDeprecation(String key, String[] newKeys, String customMessage) Adds the deprecated key to the global deprecation map. |
void | addDeprecation(String key, String newKey, String customMessage) Adds the deprecated key to the global deprecation map. |
void | addResource(String name) Add a configuration resource. |
void | addResource(URL url) Add a configuration resource. |
void | addResource(Path file) Add a configuration resource. |
void | addResource(InputStream in) Add a configuration resource. |
void | addResource(Configuration conf) Add a configuration resource. |
void | addResource(String name, boolean restrictedParser) |
void | addResource(URL url, boolean restrictedParser) |
void | addResource(Path file, boolean restrictedParser) |
void | addResource(InputStream in, boolean restrictedParser) |
void | addResource(InputStream in, String name) Add a configuration resource. |
void | clear() Clears all keys from the configuration. |
void | dumpConfiguration(Configuration config, Writer out) Writes out all properties and their attributes (final and resource) to the given Writer , the format of the output would be, { "properties" : [ { key : "key1", value : "value1", isFinal : "key1.isFinal", resource : "key1.resource" }, { key : "key2", value : "value2", isFinal : "ke2.isFinal", resource : "key2.resource" } ] }It does not output the properties of the configuration object which is loaded from an input stream. |
void | dumpDeprecatedKeys() |
String | get(String name) Get the value of the name property, null if no such property exists. |
String | get(String name, String defaultValue) Get the value of the name . |
boolean | getBoolean(String name, boolean defaultValue) Get the value of the name property as a boolean . |
Class> | getClass(String name, Class> defaultValue) Get the value of the name property as a Class . |
Class extends U> | getClass(String name, Class extends U> defaultValue, Class xface) Get the value of the name property as a Class implementing the interface specified by xface . |
Class> | getClassByName(String name) Load a class by name. |
Class> | getClassByNameOrNull(String name) Load a class by name, returning null rather than throwing an exception if it couldn't be loaded. |
Class>[] | getClasses(String name, Class>... defaultValue) Get the value of the name property as an array of Class . |
ClassLoader | getClassLoader() Get the ClassLoader for this job. |
InputStream | getConfResourceAsInputStream(String name) Get an input stream attached to the configuration resource with the given name . |
Reader | getConfResourceAsReader(String name) Get a Reader attached to the configuration resource with the given name . |
double | getDouble(String name, double defaultValue) Get the value of the name property as a double . |
T | getEnum(String name, T defaultValue) Return value matching this enumerated type. |
float | getFloat(String name, float defaultValue) Get the value of the name property as a float . |
List | getInstances(String name, Class xface) Get the value of the name property as a List of objects implementing the interface specified by xface . |
int | getInt(String name, int defaultValue) Get the value of the name property as an int . |
int[] | getInts(String name) Get the value of the name property as a set of comma-delimited int values. |
long | getLong(String name, long defaultValue) Get the value of the name property as a long . |
long | getLongBytes(String name, long defaultValue) Get the value of the name property as a long or human readable format. |
char[] | getPassword(String name) Get the value for a known password configuration element. |
Pattern | getPattern(String name, Pattern defaultValue) Get the value of the name property as a Pattern . |
String | getProperty(String key) |
String[] | getPropertySources(String name) Gets information about why a property was set. |
Map | getPropsWithPrefix(String confPrefix) Constructs a mapping of configuration and includes all properties that start with the specified configuration prefix. |
IntegerRanges | getRange(String name, String defaultValue) Parse the given attribute as a set of integer ranges |
String | getRaw(String name) Get the value of the name property, without doing variable expansion.If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. |
URL | getResource(String name) Get the URL for the named resource. |
InetSocketAddress | getSocketAddr(String name, String defaultAddress, int defaultPort) Get the socket address for name property as a InetSocketAddress . |
InetSocketAddress | getSocketAddr(String hostProperty, String addressProperty, String defaultAddressValue, int defaultPort) Get the socket address for hostProperty as a InetSocketAddress . |
Collection | getStringCollection(String name) Get the comma delimited values of the name property as a collection of String s. |
String[] | getStrings(String name) Get the comma delimited values of the name property as an array of String s. |
String[] | getStrings(String name, String... defaultValue) Get the comma delimited values of the name property as an array of String s. |
String | getTrimmed(String name, String defaultValue) Get the value of the name property as a trimmed String , defaultValue if no such property exists. |
String | getTrimmed(String name) Get the value of the name property as a trimmed String , null if no such property exists. |
Collection | getTrimmedStringCollection(String name) Get the comma delimited values of the name property as a collection of String s, trimmed of the leading and trailing whitespace. |
String[] | getTrimmedStrings(String name) Get the comma delimited values of the name property as an array of String s, trimmed of the leading and trailing whitespace. |
String[] | getTrimmedStrings(String name, String... defaultValue) Get the comma delimited values of the name property as an array of String s, trimmed of the leading and trailing whitespace. |
Map | getValByRegex(String regex) get keys matching the the regex |
boolean | isDeprecated(String key) checks whether the given key is deprecated. |
Iterator | iterator() Get an Iterator to go through the list of String key-value pairs in the configuration. |
void | main(String[] args) For debugging. |
void | readFields(DataInput in) |
void | reloadConfiguration() Reload configuration from previously added resources. |
void | set(String name, String value) Set the value of the name property. |
void | setBoolean(String name, boolean value) Set the value of the name property to a boolean . |
void | setBooleanIfUnset(String name, boolean value) Set the given property, if it is currently unset. |
void | setClass(String name, Class> theClass, Class> xface) Set the value of the name property to the name of a theClass implementing the given interface xface . |
void | setClassLoader(ClassLoader classLoader) Set the class loader that will be used to load the various objects. |
void | setDouble(String name, double value) Set the value of the name property to a double . |
void | setEnum(String name, T value) Set the value of the name property to the given type. |
void | setFloat(String name, float value) Set the value of the name property to a float . |
void | setIfUnset(String name, String value) Sets a property if it is currently unset. |
void | setInt(String name, int value) Set the value of the name property to an int . |
void | setLong(String name, long value) Set the value of the name property to a long . |
void | setPattern(String name, Pattern pattern) Set the given property to Pattern . |
void | setQuietMode(boolean quietmode) Set the quietness-mode. |
void | setSocketAddr(String name, InetSocketAddress addr) Set the socket address for the name property as a host:port . |
void | setStrings(String name, String... values) Set the array of string values for the name property as as comma delimited values. |
void | setTimeDuration(String name, long value, TimeUnit unit) Set the value of name to the given time duration. |
int | size() Return the number of keys in the configuration. |
String | toString() |
void | unset(String name) Unset a previously set property. |
void | write(DataOutput out) |
void | writeXml(OutputStream out) Write out the non-default properties in this configuration to the given OutputStream using UTF-8 encoding. |
void | writeXml(Writer out) |