|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.relayrides.pushy.apns.util.TokenUtil
public class TokenUtil
A utility class for converting APNS device tokens between byte arrays and hexadecimal strings.
Method Summary | |
---|---|
static String |
tokenBytesToString(byte[] tokenBytes)
Converts an array of bytes into a string of hexadecimal characters representing the values in the array. |
static byte[] |
tokenStringToByteArray(String tokenString)
Converts a string of hexadecimal characters into a byte array. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static byte[] tokenStringToByteArray(String tokenString)
Converts a string of hexadecimal characters into a byte array. All non-hexadecimal characters (i.e. 0-9 and
A-F) are ignored in the conversion. Note that this means that
TokenUtil.tokenBytesToString(TokenUtil.tokenStringToByteArray(tokenString))
may be different from
tokenString
.
As an example, a valid token string may look something like this: <740f4707 61bb78ad>
. This method
would return a byte array with the following values: [0x74 0x0f 0x47 0x07 0x61 0xbb 0x78 0xad]
.
tokenString
- a string of hexadecimal characters to interpret as a byte array
public static String tokenBytesToString(byte[] tokenBytes)
Converts an array of bytes into a string of hexadecimal characters representing the values in the array. For
example, calling this method on a byte array with the values [0x01 0x23 0x45 0x67 0x89 0xab]
would return
"0123456789ab"
. No guarantees are made as to the case of the returned string.
tokenBytes
- an array of bytes to represent as a string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |