|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.util.StringUtils
public class StringUtils
General string utils
| 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 |
byteToHexString(byte[] bytes)
Given an array of bytes it will convert the bytes to a hex string representation of the bytes |
static String |
formatPercent(double done,
int digits)
Format a percentage for presentation to the user. |
static String |
formatTimeDiff(long finishTime,
long startTime)
Given a finish and start time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec, for the time difference between two times. |
static String |
getFormattedTimeWithDiff(DateFormat dateFormat,
long finishTime,
long startTime)
Formats time in ms and appends difference (finishTime - startTime) as returned by formatTimeDiff(). |
static String[] |
getStrings(String str)
returns an arraylist of strings |
static byte[] |
hexStringToByte(String hex)
Given a hexstring this will return the byte array corresponding to the string |
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. |
static Path[] |
stringToPath(String[] str)
|
static URI[] |
stringToURI(String[] str)
|
static String |
uriToString(URI[] uris)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringUtils()
| Method Detail |
|---|
public static String stringifyException(Throwable e)
e - The exception to stringify
public static String simpleHostname(String fullHostname)
fullHostname - the full hostname
public static String humanReadableInt(long number)
number - the number to format
public static String formatPercent(double done,
int digits)
done - the percentage to format (0.0 to 1.0)digits - the number of digits past the decimal point
public static String arrayToString(String[] strs)
strs - Array of strings
public static String byteToHexString(byte[] bytes)
bytes -
public static byte[] hexStringToByte(String hex)
hex - the hex String array
public static String uriToString(URI[] uris)
uris - public static URI[] stringToURI(String[] str)
str - public static Path[] stringToPath(String[] str)
str -
public static String formatTimeDiff(long finishTime,
long startTime)
finishTime - finish timestartTime - start time
public static String getFormattedTimeWithDiff(DateFormat dateFormat,
long finishTime,
long startTime)
dateFormat - date format to usefinishTime - fnish timestartTime - start time
public static String[] getStrings(String str)
str - the comma seperated string values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||