|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.keyczar.util.Util
public class Util
A miscellaneous utility class. Includes random number generation, int-to-byte conversion, etc.
| Method Summary | |
|---|---|
static byte[] |
fromInt(int input)
Returns a byte array containing 4 big-endian ordered bytes representing the given integer. |
static byte[] |
fromLong(long input)
Returns a byte array containing 8 big-endian ordered bytes representing the given long. |
static com.google.gson.Gson |
gson()
|
static byte[] |
prefixHash(byte[]... inputs)
Hashes a variable number of inputs and returns a new byte array |
static void |
rand(byte[] dest)
Write random bytes into the destination. |
static byte[] |
rand(int len)
Returns an array of random bytes of the given length |
static int |
toInt(byte[] src)
Converts a given byte array to an integer. |
static long |
toLong(byte[] src)
Converts a given byte array to a long. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static com.google.gson.Gson gson()
public static byte[] fromInt(int input)
input - The integer to convert to a byte array.
public static byte[] fromLong(long input)
input - The long to convert to a byte array.
public static byte[] prefixHash(byte[]... inputs)
throws KeyczarException
inputs - The inputs to hash
KeyczarException - If the SHA-1 algorithm is not foundpublic static void rand(byte[] dest)
dest - Destionation to write the datapublic static byte[] rand(int len)
len - The length of the random array to output
public static int toInt(byte[] src)
src - A big-endian representation of an integer
public static long toLong(byte[] src)
src - A big-endian representation of a long
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||