|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.SecurePlay.SPUtil
These are global functions and constants that can be used by various portions of the SecurePlay library. Some methods in this class wrap functions to accomodate between J2me and J2se. NOTE: Some may be simply placeholders for application specific services such as the hash, encryption, and signature functions.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
static java.lang.String |
intDel
Delimiter1 = : Used for serializing internal message arrays |
static java.lang.String |
interMessDell
Delimeter3 = ~ Used for serializing multiple messages |
static java.lang.String |
INTERNAL_COMMS
Comms internal |
static java.lang.String |
messDel
Delimiter2 = ; Used for serializing the message |
static boolean |
RULESLOOPBACK
This should be set to FALSE for production systems or all "rulesXXXX methods should be edited |
static int |
SP_ID_SIZE
This value is used to set the default size of generated IDs - default is 12 |
static int |
SP_KEY_SIZE
This value is used to set game key size. |
static java.lang.String |
SP_TESTSEGMENT
This Constant is used to generate a Game Segment ID for sample code. |
static int |
SP_UPDATE_INTERVAL
This parameter is used to force an update check - only necessary for polling communications. |
| Constructor Summary | |
SPUtil()
Default Constructor. |
|
| Method Summary | |
static java.util.Vector |
addVectorToVector(java.util.Vector v1,
java.util.Vector v2)
This method adds two vectors together. |
static boolean |
arrComp(byte[] b1,
byte[] b2)
This method compares two byte arrays. |
static java.lang.Integer[] |
arrSplice(java.lang.Integer[] iarr,
int pos)
Returns a new array that removes a single element from the input Integer array at a given position |
static java.lang.String |
BinaryToString(byte[] digest)
This method convets a byte array to a string. |
static byte[] |
ByteArrAddArr(byte[] sa1,
byte[] sa2)
This method add two byte arrays together. |
static byte[] |
ByteArrAddEl(byte[] sa,
byte str)
This function appends a byte element to the end of the byte array. |
static byte[] |
ByteArrGETsubArr(byte[] strArr,
int indexStart,
int indexEnd)
This method gets the sub array of a Stirng array. |
static java.lang.String[] |
ByteArrToStringArr(byte[] bt)
Converts byte array into string array. |
static java.lang.String |
char62circadd(java.lang.String str1,
java.lang.String str2)
This function does a circular, character by character addition mod 62 assuming the strings are "right justified". |
static java.lang.String |
char62circsub(java.lang.String str1,
java.lang.String str2)
This function does a circular, character by character subtraction mod 62 assuming the strings are "right justified" this returns the result as a new string. |
static int |
char62code2num(char c)
This function takes the character code provided and converts it to a number between 0 and 61 |
static boolean |
compareStringArrays(java.lang.String[] str1,
java.lang.String[] str2)
Compares two string arrays if they contain identical items. |
static byte[] |
getHashText(java.lang.String plainText,
java.lang.String algorithm)
This method gets the hashed string |
static SPAbstractTransactionInterface |
getRegisteredTransaction(java.lang.String key)
This method gets a registered Transaction object from the register list and returns it to the user. |
static int |
HexStringToInt(java.lang.String str)
|
static java.lang.Integer[] |
IntArrAddEl(java.lang.Integer[] iarr,
int i)
This function appends a integer element to the end of the integer array. |
static java.lang.String |
INTdelimiter()
Returns a String delimiter1 Delimiter1 = ":" Used for serializing internal message arrays |
static java.lang.String |
INTMESSdelimiter()
Returns a String delimiter3 Delimiter3 = "~" Used for serialising multiple messages |
static byte[] |
IntToByte(int i)
This method converts an integer into a byte array. |
static java.lang.String |
IntToString(int i)
Integer to String. |
static java.lang.String |
LongToString(long i)
Long to String. |
static java.lang.String |
MESSdelimiter()
Returns a String delmiter2 Delimiter2 = ";" Used for serializing the message |
static int |
num2char62code(int x)
this function takes a numerical value between 0 and 61 and converts it to a character code from 0..9A..Za..z |
static boolean |
registerTransaction(java.lang.String transName,
SPAbstractTransactionInterface transInstance)
This method registers Transaction objects with so that they can be used in this library. |
static java.lang.String |
rippleadd1(java.lang.String inputstring)
This function adds 1 to the low order character of a string. |
static byte[] |
SPclone(byte[] byteArr)
|
static java.util.Hashtable |
SPclone(java.util.Hashtable htbl)
This method wraps the proper clone method of hashtable for ME and SE interoperability. |
static java.lang.String[] |
SPclone(java.lang.String[] strArr)
|
static java.lang.String |
SPgenerateKey(int keySize)
This function generates a "real" random key that is easily stored in a printable string. |
static int |
SPsmoothValue(int sampleSize,
int seed,
java.lang.Integer[] keyArray)
This is a somewhat smooth, keyed, pseudorandom number generator. |
static java.lang.String |
SPtransform(java.lang.String input,
java.lang.String gameid)
This function performs an irreversible transform on an input string to generate an output string. |
static java.lang.String[] |
StringArrAddArr(java.lang.String[] sa1,
java.lang.String[] sa2)
This method add two string arrays together. |
static java.lang.String[] |
StringArrAddEl(java.lang.String[] sa,
java.lang.String str)
This function appends a string element to the end of the String array. |
static java.lang.String[] |
StringArrGETsubArr(java.lang.String[] strArr,
int indexStart,
int indexEnd)
This method gets the sub array of a Stirng array. |
static java.lang.String[] |
StringArrRemoveEl(java.lang.String[] sa,
java.lang.String str)
This function removes a string element froma a String array. |
static byte[] |
StringArrToByteArr(java.lang.String[] strarr)
This method converts a String array to a byte array. |
static java.lang.String |
StringArrToString(java.lang.String[] sa,
java.lang.String delim)
Parces the string array into a string with delimiters separating each array indexes |
static java.util.Vector |
StringArrToVector(java.lang.String[] strArr)
This method converts a string array to a vector. |
static byte[] |
StringToBinary(java.lang.String str)
String to binary |
static int |
StringToInt(java.lang.String str)
String to integer. |
static long |
StringToLong(java.lang.String str)
String to Long. |
static java.lang.String[] |
StringToStringArr(java.lang.String str,
java.lang.String del)
This method converts a string to a string array using the specified delimiter. |
static byte[] |
subByteArr(byte[] inbArr,
int start,
int end)
This method retrieves the specified sub array of a byte array passed in. |
static java.lang.Integer |
toInt(java.lang.String str)
Converts a string representaion of an integer to Integer class. |
static java.lang.String |
toString(int i)
Converts an integer to string. |
static java.lang.String |
vectorToString(java.util.Vector v,
java.lang.String delim)
Concatinates the objects in a Vector into a string using a delimiter. |
static java.lang.String[] |
VectorToStringArr(java.util.Vector v)
This method converts a Vector to a string array. |
static java.lang.String[] |
viewRegisteredTransaction()
This method allows users to see what transactions have been registered. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String INTERNAL_COMMS
public static final int SP_ID_SIZE
public static final int SP_KEY_SIZE
public static final int SP_UPDATE_INTERVAL
public static java.lang.String SP_TESTSEGMENT
public static final java.lang.String intDel
public static final java.lang.String messDel
public static final java.lang.String interMessDell
public static final boolean RULESLOOPBACK
| Constructor Detail |
public SPUtil()
| Method Detail |
public static java.lang.String rippleadd1(java.lang.String inputstring)
inputstring - String
public static java.lang.String char62circadd(java.lang.String str1,
java.lang.String str2)
str1 - Stringstr2 - String
public static java.lang.String char62circsub(java.lang.String str1,
java.lang.String str2)
str1 - Stringstr2 - String
public static int char62code2num(char c)
c - char - a character code
public static int num2char62code(int x)
x - int - a number between 0 and 61
public static int SPsmoothValue(int sampleSize,
int seed,
java.lang.Integer[] keyArray)
sampleSize - intseed - intkeyArray - Integer[]
public static java.lang.String INTdelimiter()
public static java.lang.String MESSdelimiter()
public static java.lang.String INTMESSdelimiter()
public static java.lang.String vectorToString(java.util.Vector v,
java.lang.String delim)
v - Vector - Vector to be converteddelim - String - delimiter to be used
public static java.lang.String StringArrToString(java.lang.String[] sa,
java.lang.String delim)
sa - String[] - String array to be converted into a Stringdelim - String - the delimiter that will parce the string
public static java.lang.String[] StringArrAddEl(java.lang.String[] sa,
java.lang.String str)
sa - String[] - a string array that needs an element to be added.str - String - the element to be added.
public static java.lang.Integer[] IntArrAddEl(java.lang.Integer[] iarr,
int i)
iarr - Integer[] - the integer array that needs an element to be added.i - int - the element to be added.
public static java.lang.Integer[] arrSplice(java.lang.Integer[] iarr,
int pos)
iarr - Integer[] - the Integer array to be edited.pos - int - the position from where the element is to be removed.
public static java.lang.String[] StringArrAddArr(java.lang.String[] sa1,
java.lang.String[] sa2)
sa1 - String[] - string array to be added.sa2 - String[] - string array to be added.
public static java.lang.String[] ByteArrToStringArr(byte[] bt)
bt - byte[] - byte array to be converted.
public static byte[] StringArrToByteArr(java.lang.String[] strarr)
strarr - String[] - string array
public static java.lang.String[] StringToStringArr(java.lang.String str,
java.lang.String del)
str - String - string to be converted.del - String - the delimiter to be used to parce the string.
public static java.lang.Integer toInt(java.lang.String str)
str - - String - string representaion of an integer
public static java.lang.String toString(int i)
i - - int
public static java.lang.String[] StringArrRemoveEl(java.lang.String[] sa,
java.lang.String str)
sa - String[] - a string array that needs an element to be removed.str - String - the element to be removed.
public static java.lang.String BinaryToString(byte[] digest)
digest - byte[] - byte array to be converted
public static byte[] StringToBinary(java.lang.String str)
str -
public static int StringToInt(java.lang.String str)
str - String - string number to be converted to int.
public static int HexStringToInt(java.lang.String str)
public static java.lang.String IntToString(int i)
i - int - int number to be converted to string
public static byte[] ByteArrAddArr(byte[] sa1,
byte[] sa2)
sa1 - byte[] - byte array to be added.sa2 - byte[] - byte array to be added.
public static byte[] ByteArrAddEl(byte[] sa,
byte str)
sa - byte[] - a byte array that needs an element to be added.str - byte - the element to be added.
public static byte[] IntToByte(int i)
i - int - integer to be converted
public static byte[] subByteArr(byte[] inbArr,
int start,
int end)
inbArr - byte[] - byte array to be subed from.start - int - start index of the sub array.end - int - end index of the sub array.
public static boolean arrComp(byte[] b1,
byte[] b2)
b1 - byte[] - byte array to be comparedb2 - byte[] - byte array to be compared
public static java.util.Vector addVectorToVector(java.util.Vector v1,
java.util.Vector v2)
v1 - Vector - vector onev2 - Vector - vector two
public static java.lang.String[] VectorToStringArr(java.util.Vector v)
v - Vector - vector to be converted
public static java.util.Vector StringArrToVector(java.lang.String[] strArr)
strArr - String[] - string array to be converted
public static java.lang.String[] StringArrGETsubArr(java.lang.String[] strArr,
int indexStart,
int indexEnd)
strArr - String[] - the array from which the sub array will be extractedindexStart - int - starting index.indexEnd - int - ending index.
public static byte[] ByteArrGETsubArr(byte[] strArr,
int indexStart,
int indexEnd)
strArr - String[] - the array from which the sub array will be extractedindexStart - int - starting index.indexEnd - int - ending index.
public static java.lang.String LongToString(long i)
i - int - int number to be converted to string
public static long StringToLong(java.lang.String str)
str - String - string number to be converted to long
public static boolean compareStringArrays(java.lang.String[] str1,
java.lang.String[] str2)
str1 - str2 -
public static java.lang.String[] SPclone(java.lang.String[] strArr)
strArr -
public static byte[] SPclone(byte[] byteArr)
byteArr -
public static boolean registerTransaction(java.lang.String transName,
SPAbstractTransactionInterface transInstance)
transName - String - transaction nametransInstance - SPAbstractTransactionInterface - the transaction object instance
public static java.lang.String[] viewRegisteredTransaction()
public static SPAbstractTransactionInterface getRegisteredTransaction(java.lang.String key)
key - String - the name of the transaction.
public static java.lang.String SPgenerateKey(int keySize)
keySize - int - a positive value - should be large enough to generate a good range of keys. SecurePlay library examples use 25
public static java.lang.String SPtransform(java.lang.String input,
java.lang.String gameid)
input - String
public static byte[] getHashText(java.lang.String plainText,
java.lang.String algorithm)
plainText - String - string to be hashedalgorithm - String - The algorithm to use like MD2, MD5, SHA-1, etc.
public static java.util.Hashtable SPclone(java.util.Hashtable htbl)
htbl - Hashtable - hashtable to be cloned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||