|
Smack | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jivesoftware.smack.util.StringUtils
A collection of utility methods for String objects.
Method Summary | |
static byte[] |
decodeBase64(String data)
Decodes a base64 String. |
static String |
encodeBase64(byte[] data)
Encodes a byte array into a base64 String. |
static String |
encodeBase64(String data)
Encodes a String as a base64 String. |
static String |
encodeHex(byte[] bytes)
Turns an array of bytes into a String representing each byte as an unsigned hex number. |
static String |
escapeForXML(String string)
Escapes all necessary characters in the String so that it can be used in an XML doc. |
static String |
hash(String data)
Hashes a String using the SHA-1 algorithm and returns the result as a String of hexadecimal numbers. |
static String |
parseName(String ID)
Returns the name portion of a XMPP ID. |
static String |
parseResource(String ID)
Returns the name portion of a XMPP ID. |
static String |
parseServer(String ID)
Returns the name portion of a XMPP ID. |
static String |
randomString(int length)
Returns a random String of numbers and letters (lower and upper case) of the specified length. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static String parseName(String ID)
ID
- the XMPP ID.
public static String parseServer(String ID)
ID
- the XMPP ID.
public static String parseResource(String ID)
ID
- the XMPP ID.
public static final String escapeForXML(String string)
string
- the string to escape.
public static final String hash(String data)
A hash is a one-way function -- that is, given an input, an output is easily computed. However, given the output, the input is almost impossible to compute. This is useful for passwords since we can store the hash and a hacker will then have a very hard time determining the original password.
data
- the String to compute the hash of.
public static final String encodeHex(byte[] bytes)
Method by Santeri Paavolainen, Helsinki Finland 1996
(c) Santeri Paavolainen, Helsinki Finland 1996
Distributed under LGPL.
bytes
- an array of bytes to convert to a hex-string
public static String encodeBase64(String data)
data
- a String to encode.
public static String encodeBase64(byte[] data)
data
- a byte array to encode.
public static byte[] decodeBase64(String data)
data
- a base64 encoded String to decode.
public static final String randomString(int length)
The specified length must be at least one. If not, the method will return null.
length
- the desired length of the random String to return.
|
Smack | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |