|
RADIUS Client API (V3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectUtil
RADIUS utilities class.
| Constructor Summary | |
Util()
|
|
| Method Summary | |
static boolean |
cmp(byte[] a,
byte[] b)
Compare two byte arrays. |
static boolean |
cmp(byte[] a,
int startA,
byte[] b,
int startB,
int length)
Compare two byte arrays over a region. |
static String |
dump(byte[] buf,
int start,
int length)
Display a block of bytes sixteen bytes per row. |
static String |
dumpStack(Throwable t)
Return the stack trace as a string. |
static byte[] |
hexToArray(String hexString)
Return an array of bytes from a hex string. |
static String[] |
splitUserName(String name,
char prefix,
char realm)
Split the User-Name into prefix, name, and realm. |
static String |
toASCII(byte[] b)
Convert a byte array to a string using ASCII encoding. |
static byte[] |
toASCII(String s)
Convert a string to bytes encoded using ASCII, the TACACS+ protocol standard encoding. |
static String |
toHexString(byte[] buf)
Convert a byte buffer to a hex string. |
static String |
toHexString(byte[] buf,
int start,
int length)
Convert a byte buffer to a hex string. |
static String |
toUTF8(byte[] b)
Convert a byte array to a string using UTF8 encoding. |
static byte[] |
toUTF8(char[] c)
Convert a char array to a UTF8 byte array. |
static byte[] |
toUTF8(String s)
Convert a string to bytes encoded using UTF8, the RADIUS protocol standard encoding. |
| Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Util()
| Method Detail |
public static byte[] toUTF8(String s)
In the event that UTF8 is unavailable (highly unlikely) the encoding will be US-ASCII.
s - String to convert to a UTF8 byte array.
public static String toUTF8(byte[] b)
In the event that UTF8 is unavailable (highly unlikely) the encoding will be US-ASCII.
b - Byte array to convert.
public static byte[] toUTF8(char[] c)
In the event that UTF8 is unavailable (highly unlikely) the encoding will be US-ASCII.
c - Char array to convert.
public static String dump(byte[] buf,
int start,
int length)
buf - Buffer to display.start - Start position in buffer.length - Length of data to dump.
public static String toHexString(byte[] buf)
buf - Byte array.
public static String toHexString(byte[] buf,
int start,
int length)
buf - Byte array.start - Start position in array.length - Number of bytes to display.
public static boolean cmp(byte[] a,
byte[] b)
a - array ab - array b
public static boolean cmp(byte[] a,
int startA,
byte[] b,
int startB,
int length)
a - Array A.startA - The start position for comparing A.b - Array B.startB - The start position for comparing B.length - Length of region.
public static String dumpStack(Throwable t)
t - Exception to trace.public static byte[] toASCII(String s)
toUTF8().
In the event that US-ASCII is unavailable (highly unlikely) the encoding will be the platform's default encoding.
s - String to convert to a ASCII byte array.
public static String toASCII(byte[] b)
toUTF8().
In the event that US-ASCII is unavailable (highly unlikely) the encoding will be the platform's default encoding.
b - Byte array to convert.
public static String[] splitUserName(String name,
char prefix,
char realm)
For example 'prefix/name@realm' would be returned as ["prefix"] ["name"] ["realm"] as would 'prefix//name@realm'. 'name@realm' would be returned as [""] ["name"] ["realm"].
name - User-Name value.prefix - Prefix character. If this character is sequentially repeated (like 'prefix//name')
all the prefix characters will be stripped.realm - realm character. This is usually a '@'.
public static byte[] hexToArray(String hexString)
throws IllegalArgumentException
hexString - Hex string to convert.
IllegalArgumentException - if there's a problem parsing the hex string.
|
RADIUS Client API (V3) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||