org.apache.hadoop.util
Class StringUtils

java.lang.Object
  extended by org.apache.hadoop.util.StringUtils

public class StringUtils
extends Object

General string utils

Author:
Owen O'Malley

Constructor Summary
StringUtils()
           
 
Method Summary
static String arrayToString(String[] strs)
          Given an array of strings, return a comma-separated list of its elements.
static String humanReadableInt(long number)
          Given an integer, return a string that is in an approximate, but human readable format.
static String simpleHostname(String fullHostname)
          Given a full hostname, return the word upto the first dot.
static String stringifyException(Throwable e)
          Make a string representation of the exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

stringifyException

public static String stringifyException(Throwable e)
Make a string representation of the exception.

Parameters:
e - The exception to stringify
Returns:
A string with exception name and call stack.

simpleHostname

public static String simpleHostname(String fullHostname)
Given a full hostname, return the word upto the first dot.

Parameters:
fullHostname - the full hostname
Returns:
the hostname to the first dot

humanReadableInt

public static String humanReadableInt(long number)
Given an integer, return a string that is in an approximate, but human readable format. It uses the bases 'k', 'm', and 'g' for 1024, 1024**2, and 1024**3.

Parameters:
number - the number to format
Returns:
a human readable form of the integer

arrayToString

public static String arrayToString(String[] strs)
Given an array of strings, return a comma-separated list of its elements.

Parameters:
strs - Array of strings
Returns:
Empty string if strs.length is 0, comma separated list of strings otherwise


Copyright © 2006 The Apache Software Foundation