當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.equalsIgnoreCase方法代碼示例

本文整理匯總了Java中org.apache.hadoop.util.StringUtils.equalsIgnoreCase方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.equalsIgnoreCase方法的具體用法?Java StringUtils.equalsIgnoreCase怎麽用?Java StringUtils.equalsIgnoreCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.equalsIgnoreCase方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBoolean

import org.apache.hadoop.util.StringUtils; //導入方法依賴的package包/類
/** 
 * Get the value of the <code>name</code> property as a <code>boolean</code>.  
 * If no such property is specified, or if the specified value is not a valid
 * <code>boolean</code>, then <code>defaultValue</code> is returned.
 * 
 * @param name property name.
 * @param defaultValue default value.
 * @return property value as a <code>boolean</code>, 
 *         or <code>defaultValue</code>. 
 */
public boolean getBoolean(String name, boolean defaultValue) {
  String valueString = getTrimmed(name);
  if (null == valueString || valueString.isEmpty()) {
    return defaultValue;
  }

  if (StringUtils.equalsIgnoreCase("true", valueString))
    return true;
  else if (StringUtils.equalsIgnoreCase("false", valueString))
    return false;
  else return defaultValue;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:23,代碼來源:Configuration.java

示例2: buildXAttr

import org.apache.hadoop.util.StringUtils; //導入方法依賴的package包/類
/**
 * Build <code>XAttr</code> from name with prefix and value.
 * Name can not be null. Value can be null. The name and prefix 
 * are validated.
 * Both name and namespace are case sensitive.
 */
public static XAttr buildXAttr(String name, byte[] value) {
  Preconditions.checkNotNull(name, "XAttr name cannot be null.");
  
  final int prefixIndex = name.indexOf(".");
  if (prefixIndex < 3) {// Prefix length is at least 3.
    throw new HadoopIllegalArgumentException("An XAttr name must be " +
        "prefixed with user/trusted/security/system/raw, followed by a '.'");
  } else if (prefixIndex == name.length() - 1) {
    throw new HadoopIllegalArgumentException("XAttr name cannot be empty.");
  }
  
  NameSpace ns;
  final String prefix = name.substring(0, prefixIndex);
  if (StringUtils.equalsIgnoreCase(prefix, NameSpace.USER.toString())) {
    ns = NameSpace.USER;
  } else if (
      StringUtils.equalsIgnoreCase(prefix, NameSpace.TRUSTED.toString())) {
    ns = NameSpace.TRUSTED;
  } else if (
      StringUtils.equalsIgnoreCase(prefix, NameSpace.SYSTEM.toString())) {
    ns = NameSpace.SYSTEM;
  } else if (
      StringUtils.equalsIgnoreCase(prefix, NameSpace.SECURITY.toString())) {
    ns = NameSpace.SECURITY;
  } else if (
      StringUtils.equalsIgnoreCase(prefix, NameSpace.RAW.toString())) {
    ns = NameSpace.RAW;
  } else {
    throw new HadoopIllegalArgumentException("An XAttr name must be " +
        "prefixed with user/trusted/security/system/raw, followed by a '.'");
  }
  XAttr xAttr = (new XAttr.Builder()).setNameSpace(ns).setName(name.
      substring(prefixIndex + 1)).setValue(value).build();
  
  return xAttr;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:43,代碼來源:XAttrHelper.java

示例3: getEditsVisitor

import org.apache.hadoop.util.StringUtils; //導入方法依賴的package包/類
/**
 * Factory function that creates an EditsVisitor object
 *
 * @param filename              output filename
 * @param processor             type of visitor to create 
 * @param printToScreen         parameter passed to visitor constructor
 *
 * @return EditsVisitor for appropriate output format (binary, xml, etc.)
 */
static public OfflineEditsVisitor getEditsVisitor(String filename,
  String processor, boolean printToScreen) throws IOException {
  if(StringUtils.equalsIgnoreCase("binary", processor)) {
    return new BinaryEditsVisitor(filename);
  }
  OfflineEditsVisitor vis;
  OutputStream fout = new FileOutputStream(filename);
  OutputStream out = null;
  try {
    if (!printToScreen) {
      out = fout;
    }
    else {
      OutputStream outs[] = new OutputStream[2];
      outs[0] = fout;
      outs[1] = System.out;
      out = new TeeOutputStream(outs);
    }
    if(StringUtils.equalsIgnoreCase("xml", processor)) {
      vis = new XmlEditsVisitor(out);
    } else if(StringUtils.equalsIgnoreCase("stats", processor)) {
      vis = new StatisticsEditsVisitor(out);
    } else {
      throw new IOException("Unknown proccesor " + processor +
        " (valid processors: xml, binary, stats)");
    }
    out = fout = null;
    return vis;
  } finally {
    IOUtils.closeStream(fout);
    IOUtils.closeStream(out);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:43,代碼來源:OfflineEditsVisitorFactory.java


注:本文中的org.apache.hadoop.util.StringUtils.equalsIgnoreCase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。