Tabnine Logo
StringUtils.toLowerCase
Code IndexAdd Tabnine to your IDE (free)

How to use
toLowerCase
method
in
org.apache.hadoop.util.StringUtils

Best Java code snippets using org.apache.hadoop.util.StringUtils.toLowerCase (Showing top 20 results out of 423)

origin: org.apache.hadoop/hadoop-common

 @Override
 public boolean hasCapability(String capability) {
  switch (StringUtils.toLowerCase(capability)) {
  case StreamCapabilities.READAHEAD:
  case StreamCapabilities.DROPBEHIND:
  case StreamCapabilities.UNBUFFER:
   return true;
  default:
   return false;
  }
 }
}
origin: org.apache.hadoop/hadoop-common

MetricsConfig(Configuration c, String prefix) {
 super(c, StringUtils.toLowerCase(prefix), ".");
}
origin: org.apache.hadoop/hadoop-common

Key(URI uri, Configuration conf, long unique) throws IOException {
 scheme = uri.getScheme()==null ?
   "" : StringUtils.toLowerCase(uri.getScheme());
 authority = uri.getAuthority()==null ?
   "" : StringUtils.toLowerCase(uri.getAuthority());
 this.unique = unique;
 this.ugi = UserGroupInformation.getCurrentUser();
}
origin: org.apache.hadoop/hadoop-common

public static boolean isLocalhost(String host) {
  host = host != null ? StringUtils.toLowerCase(host.trim()) : "";
  if (host.startsWith("::1")) {
    int x = host.lastIndexOf('%');
    if (x >= 0) {
      host = host.substring(0, x);
    }
  }
  int x = Arrays.binarySearch(LOCALHOSTS, host);
  return x >= 0;
}
origin: org.apache.hadoop/hadoop-common

 /**
  * Returns suffix of cipher suite configuration.
  * @return String configuration suffix
  */
 public String getConfigSuffix() {
  String[] parts = name.split("/");
  StringBuilder suffix = new StringBuilder();
  for (String part : parts) {
   suffix.append(".").append(StringUtils.toLowerCase(part));
  }
  
  return suffix.toString();
 }
}
origin: org.apache.hadoop/hadoop-common

private void addCodec(CompressionCodec codec) {
 String suffix = codec.getDefaultExtension();
 codecs.put(new StringBuilder(suffix).reverse().toString(), codec);
 codecsByClassName.put(codec.getClass().getCanonicalName(), codec);
 String codecName = codec.getClass().getSimpleName();
 codecsByName.put(StringUtils.toLowerCase(codecName), codec);
 if (codecName.endsWith("Codec")) {
  codecName = codecName.substring(0, codecName.length() - "Codec".length());
  codecsByName.put(StringUtils.toLowerCase(codecName), codec);
 }
}
origin: org.apache.hadoop/hadoop-common

public static void setAuthenticationMethod(
  AuthenticationMethod authenticationMethod, Configuration conf) {
 if (authenticationMethod == null) {
  authenticationMethod = AuthenticationMethod.SIMPLE;
 }
 conf.set(HADOOP_SECURITY_AUTHENTICATION,
   StringUtils.toLowerCase(authenticationMethod.toString()));
}
origin: org.apache.hadoop/hadoop-common

private static String replacePattern(String[] components, String hostname)
  throws IOException {
 String fqdn = hostname;
 if (fqdn == null || fqdn.isEmpty() || fqdn.equals("0.0.0.0")) {
  fqdn = getLocalHostName(null);
 }
 return components[0] + "/" +
   StringUtils.toLowerCase(fqdn) + "@" + components[2];
}
origin: org.apache.hadoop/hadoop-common

/**
 * Convert SOME_STUFF to SomeStuff
 *
 * @param s input string
 * @return camelized string
 */
public static String camelize(String s) {
 StringBuilder sb = new StringBuilder();
 String[] words = split(StringUtils.toLowerCase(s), ESCAPE_CHAR,  '_');
 for (String word : words)
  sb.append(org.apache.commons.lang3.StringUtils.capitalize(word));
 return sb.toString();
}
origin: org.apache.hadoop/hadoop-common

static MetricsConfig create(String prefix) {
 return loadFirst(prefix, "hadoop-metrics2-" +
   StringUtils.toLowerCase(prefix) + ".properties", DEFAULT_FILE_NAME);
}
origin: org.apache.hadoop/hadoop-common

/**
 * Resolves a property name to its client/server version if applicable.
 * <p/>
 * NOTE: This method is public for testing purposes.
 *
 * @param mode client/server mode.
 * @param template property name template.
 * @return the resolved property name.
 */
@VisibleForTesting
public static String resolvePropertyName(SSLFactory.Mode mode,
                     String template) {
 return MessageFormat.format(
   template, StringUtils.toLowerCase(mode.toString()));
}
origin: org.apache.hadoop/hadoop-common

/**
 * Construct the service key for a token
 * @param addr InetSocketAddress of remote connection with a token
 * @return "ip:port" or "host:port" depending on the value of
 *          hadoop.security.token.service.use_ip
 */
public static Text buildTokenService(InetSocketAddress addr) {
 String host = null;
 if (useIpForTokenService) {
  if (addr.isUnresolved()) { // host has no ip address
   throw new IllegalArgumentException(
     new UnknownHostException(addr.getHostName())
   );
  }
  host = addr.getAddress().getHostAddress();
 } else {
  host = StringUtils.toLowerCase(addr.getHostName());
 }
 return new Text(host + ":" + addr.getPort());
}
origin: org.apache.hadoop/hadoop-common

@Override
public Result apply(PathData item, int depth) throws IOException {
 String name = getPath(item).getName();
 if (!caseSensitive) {
  name = StringUtils.toLowerCase(name);
 }
 if (globPattern.matches(name)) {
  return Result.PASS;
 } else {
  return Result.FAIL;
 }
}
origin: org.apache.hadoop/hadoop-common

/**
 * Returns a string representation guaranteed to be stable across versions to
 * satisfy backward compatibility requirements, such as for shell command
 * output or serialization.  The format of this string representation matches
 * what is expected by the {@link #parseAclSpec(String, boolean)} and
 * {@link #parseAclEntry(String, boolean)} methods.
 *
 * @return stable, backward compatible string representation
 */
public String toStringStable() {
 StringBuilder sb = new StringBuilder();
 if (scope == AclEntryScope.DEFAULT) {
  sb.append("default:");
 }
 if (type != null) {
  sb.append(StringUtils.toLowerCase(type.toStringStable()));
 }
 sb.append(':');
 if (name != null) {
  sb.append(name);
 }
 sb.append(':');
 if (permission != null) {
  sb.append(permission.SYMBOL);
 }
 return sb.toString();
}
origin: org.apache.hadoop/hadoop-common

/**
 * Find the relevant compression codec for the codec's canonical class name
 * or by codec alias.
 * <p/>
 * Codec aliases are case insensitive.
 * <p/>
 * The code alias is the short class name (without the package name).
 * If the short class name ends with 'Codec', then there are two aliases for
 * the codec, the complete short class name and the short class name without
 * the 'Codec' ending. For example for the 'GzipCodec' codec class name the
 * alias are 'gzip' and 'gzipcodec'.
 *
 * @param codecName the canonical class name of the codec
 * @return the codec object
 */
public CompressionCodec getCodecByName(String codecName) {
 if (codecsByClassName == null) {
  return null;
 }
 CompressionCodec codec = getCodecByClassName(codecName);
 if (codec == null) {
  // trying to get the codec by name in case the name was specified
  // instead a class
  codec = codecsByName.get(StringUtils.toLowerCase(codecName));
 }
 return codec;
}
origin: org.apache.hadoop/hadoop-common

@Override
public void prepare() throws IOException {
 String argPattern = getArgument(1);
 if (!caseSensitive) {
  argPattern = StringUtils.toLowerCase(argPattern);
 }
 globPattern = new GlobPattern(argPattern);
}
origin: apache/flink

/**
 * Return time duration in the given time unit. Valid units are encoded in
 * properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
 * (ms), seconds (s), minutes (m), hours (h), and days (d).
 * @param name Property name
 * @param vStr The string value with time unit suffix to be converted.
 * @param unit Unit to convert the stored property, if it exists.
 */
public long getTimeDurationHelper(String name, String vStr, TimeUnit unit) {
  vStr = vStr.trim();
  vStr = StringUtils.toLowerCase(vStr);
  ParsedTimeDuration vUnit = ParsedTimeDuration.unitFor(vStr);
  if (null == vUnit) {
    logDeprecation("No unit for " + name + "(" + vStr + ") assuming " + unit);
    vUnit = ParsedTimeDuration.unitFor(unit);
  } else {
    vStr = vStr.substring(0, vStr.lastIndexOf(vUnit.suffix()));
  }
  long raw = Long.parseLong(vStr);
  long converted = unit.convert(raw, vUnit.unit());
  if (vUnit.unit().convert(converted, unit) < raw) {
    logDeprecation("Possible loss of precision converting " + vStr
        + vUnit.suffix() + " to " + unit + " for " + name);
  }
  return converted;
}
origin: org.apache.hadoop/hadoop-common

@Override
public KeyVersion createKey(String name, byte[] material,
               Options options) throws IOException {
 Preconditions.checkArgument(name.equals(StringUtils.toLowerCase(name)),
   "Uppercase key names are unsupported: %s", name);
 writeLock.lock();
 try {
  try {
   if (keyStore.containsAlias(name) || cache.containsKey(name)) {
    throw new IOException("Key " + name + " already exists in " + this);
   }
  } catch (KeyStoreException e) {
   throw new IOException("Problem looking up key " + name + " in " + this,
     e);
  }
  Metadata meta = new Metadata(options.getCipher(), options.getBitLength(),
    options.getDescription(), options.getAttributes(), new Date(), 1);
  if (options.getBitLength() != 8 * material.length) {
   throw new IOException("Wrong key length. Required " +
     options.getBitLength() + ", but got " + (8 * material.length));
  }
  cache.put(name, meta);
  String versionName = buildVersionName(name, 0);
  return innerSetKeyVersion(name, versionName, material, meta.getCipher());
 } finally {
  writeLock.unlock();
 }
}
origin: org.apache.hadoop/hadoop-common

String contentType = conn.getHeaderField(CONTENT_TYPE);
contentType =
  (contentType != null) ? StringUtils.toLowerCase(contentType) : null;
if (contentType != null &&
  contentType.contains(APPLICATION_JSON_MIME)) {
origin: org.apache.hadoop/hadoop-common

/**
 * Return time duration in the given time unit. Valid units are encoded in
 * properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
 * (ms), seconds (s), minutes (m), hours (h), and days (d).
 * @param name Property name
 * @param vStr The string value with time unit suffix to be converted.
 * @param unit Unit to convert the stored property, if it exists.
 */
public long getTimeDurationHelper(String name, String vStr, TimeUnit unit) {
 vStr = vStr.trim();
 vStr = StringUtils.toLowerCase(vStr);
 ParsedTimeDuration vUnit = ParsedTimeDuration.unitFor(vStr);
 if (null == vUnit) {
  logDeprecation("No unit for " + name + "(" + vStr + ") assuming " + unit);
  vUnit = ParsedTimeDuration.unitFor(unit);
 } else {
  vStr = vStr.substring(0, vStr.lastIndexOf(vUnit.suffix()));
 }
 long raw = Long.parseLong(vStr);
 long converted = unit.convert(raw, vUnit.unit());
 if (vUnit.unit().convert(converted, unit) < raw) {
  logDeprecation("Possible loss of precision converting " + vStr
    + vUnit.suffix() + " to " + unit + " for " + name);
 }
 return converted;
}
org.apache.hadoop.utilStringUtilstoLowerCase

Javadoc

Converts all of the characters in this String to lower case with Locale.ENGLISH.

Popular methods of StringUtils

  • stringifyException
    Make a string representation of the exception.
  • join
    Concatenates strings, using a separator.
  • split
  • arrayToString
  • escapeString
  • startupShutdownMessage
    Print a log message for starting up and shutting down
  • getStrings
    Returns an arraylist of strings.
  • toUpperCase
    Converts all of the characters in this String to upper case with Locale.ENGLISH.
  • byteToHexString
    Given an array of bytes it will convert the bytes to a hex string representation of the bytes
  • formatTime
    Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.
  • unEscapeString
  • getStringCollection
    Returns a collection of strings.
  • unEscapeString,
  • getStringCollection,
  • byteDesc,
  • formatPercent,
  • getTrimmedStrings,
  • equalsIgnoreCase,
  • format,
  • formatTimeDiff,
  • getTrimmedStringCollection

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now