|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.StringUtils
public final class StringUtils
contains static utitity methods which are useful, when working with
Strings.
| Nested Class Summary | |
|---|---|
static class |
StringUtils.StringElementIterator
Simple ListIterator<String> that operates on a
String split by a regex. |
| Method Summary | |
|---|---|
static java.lang.String |
digest16(byte[] bytes)
hashes the byte[] using <em>SHA-512</em>. |
static java.lang.String |
digest16(java.lang.String str)
hashes the given string using <em>SHA-512</em>. |
static java.lang.String |
digest62(byte[] bytes)
hashes the byte[] using <em>SHA-512</em>. |
static java.lang.String |
digest62(java.lang.String str)
hashes the string using <em>SHA-512</em>. |
static java.math.BigInteger |
fromBase62String(java.lang.String base62)
returns the BigInteger represented by the given base 62 string. |
static java.lang.String |
getEncoding(java.lang.String s)
returns the encoding of the given String. |
static java.lang.String |
getStackTrace(java.lang.Throwable t)
returns the stack trace of the given Throwable as a string. |
static java.lang.String |
getString(java.lang.Object o)
returns either the given object's string representation or "null", if the given object is null. |
static java.lang.String |
insertFractionDot(java.lang.String s,
int pos)
Inserts a fraction-dot into the given string at after the given position (counting from the back) filling the string up with 0s (zeros) if too short. |
static java.lang.StringBuilder |
insertFromBack(java.lang.String s,
int pos,
java.lang.String insert,
java.lang.String fill)
Inserts the given string insert at the specified position pos from the back of the string. |
static java.lang.String |
maxLength(java.lang.String s,
int l)
ensures that the given String does not exceed the given maximum
length, cutting off all characters exceeding characters. |
static java.lang.String |
toBase62String(java.math.BigInteger token)
returns a base 62 string for the given BigInteger. |
static java.lang.String |
toBase62String(byte[] bytes)
returns a base 62 string for the given byte array. |
static java.lang.String |
toHexString(byte[] bs)
turns a given byte[] into a string of hexadecimal numbers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String getEncoding(java.lang.String s)
String.
s - the string to inspect
public static java.lang.String toHexString(byte[] bs)
byte[] into a string of hexadecimal numbers.
For example 127, 126 get FFFE.
bs - the bytes
public static java.lang.String toBase62String(java.math.BigInteger token)
BigInteger.
token - the number to be converted
public static java.lang.String toBase62String(byte[] bytes)
bytes - the byte array
public static java.math.BigInteger fromBase62String(java.lang.String base62)
BigInteger represented by the given base 62 string.
base62 - the base 62 encoded value
BigInteger represented by the given base 62 string
public static java.lang.String digest16(java.lang.String str)
throws java.security.NoSuchAlgorithmException
<em>SHA-512</em>.
str - the string
java.security.NoSuchAlgorithmException - if the hashing algorithm is not available
public static java.lang.String digest16(byte[] bytes)
throws java.security.NoSuchAlgorithmException
<em>SHA-512</em>.
bytes - the bytes
java.security.NoSuchAlgorithmException - if the hashing algorithm is not available
public static java.lang.String digest62(java.lang.String str)
throws java.security.NoSuchAlgorithmException
<em>SHA-512</em>.
str - the string
java.security.NoSuchAlgorithmException - if the hashing algorithm is not available
public static java.lang.String digest62(byte[] bytes)
throws java.security.NoSuchAlgorithmException
<em>SHA-512</em>.
bytes - the bytes
java.security.NoSuchAlgorithmException - if the hashing algorithm is not availablepublic static java.lang.String getStackTrace(java.lang.Throwable t)
Throwable as a string.
t - the throwable
Throwable as a string
public static java.lang.String insertFractionDot(java.lang.String s,
int pos)
s - the string to formatpos - the position to insert the fraction-dot
public static java.lang.StringBuilder insertFromBack(java.lang.String s,
int pos,
java.lang.String insert,
java.lang.String fill)
s - the string to be formattedpos - the positioninsert - the string to insertfill - the fill
StringBuilder
public static java.lang.String maxLength(java.lang.String s,
int l)
String does not exceed the given maximum
length, cutting off all characters exceeding characters.
null values will be converted to empty strings.
s - the stringl - the maximum length
public static java.lang.String getString(java.lang.Object o)
null.
o - the object
null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||