Example usage for org.apache.hadoop.util StringUtils getTrimmedStrings

List of usage examples for org.apache.hadoop.util StringUtils getTrimmedStrings

Introduction

In this page you can find the example usage for org.apache.hadoop.util StringUtils getTrimmedStrings.

Prototype

public static String[] getTrimmedStrings(String str) 

Source Link

Document

Splits a comma or newline separated value String, trimming leading and trailing whitespace on each value.

Usage

From source file:co.cask.tigon.conf.Configuration.java

License:Apache License

/**
 * Get the comma delimited values of the <code>name</code> property as
 * an array of <code>String</code>s, trimmed of the leading and trailing whitespace.
 * If no such property is specified then an empty array is returned.
 *
 * @param name property name./*  w ww  .  j av a2s  .  co m*/
 * @return property value as an array of trimmed <code>String</code>s,
 *         or empty array.
 */
public String[] getTrimmedStrings(String name) {
    String valueString = get(name);
    return StringUtils.getTrimmedStrings(valueString);
}

From source file:co.cask.tigon.conf.Configuration.java

License:Apache License

/**
 * Get the comma delimited values of the <code>name</code> property as
 * an array of <code>String</code>s, trimmed of the leading and trailing whitespace.
 * If no such property is specified then default value is returned.
 *
 * @param name property name./*from   w w  w.  j  av  a  2  s  .  c o  m*/
 * @param defaultValue The default value
 * @return property value as an array of trimmed <code>String</code>s,
 *         or default value.
 */
public String[] getTrimmedStrings(String name, String... defaultValue) {
    String valueString = get(name);
    if (null == valueString) {
        return defaultValue;
    } else {
        return StringUtils.getTrimmedStrings(valueString);
    }
}