Package de.fraunhofer.iese.mydata.util
Class RandomStringUtil
- java.lang.Object
-
- de.fraunhofer.iese.mydata.util.RandomStringUtil
-
public class RandomStringUtil extends Object
Generate a random string
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALPHANUM
Alphanumeric charactersstatic String
ALPHANUMSPECIAL
Alphanumeric characters and special charsstatic String
DIGITS
Digitsstatic String
LOWER
Lower case lettersstatic String
SPECIAL
Special characters that you can also use in URL parameters without codingstatic String
UPPER
Upper case letters
-
Constructor Summary
Constructors Constructor Description RandomStringUtil()
Create session identifiers.RandomStringUtil(int length)
Create an alphanumeric strings from a secure generator.RandomStringUtil(int length, String symbols)
RandomStringUtil(int length, Random random)
Create an alphanumeric string generator.RandomStringUtil(int length, Random random, String symbols)
-
-
-
Field Detail
-
UPPER
public static final String UPPER
Upper case letters- See Also:
- Constant Field Values
-
LOWER
public static final String LOWER
Lower case letters
-
DIGITS
public static final String DIGITS
Digits- See Also:
- Constant Field Values
-
SPECIAL
public static final String SPECIAL
Special characters that you can also use in URL parameters without coding- See Also:
- Constant Field Values
-
ALPHANUM
public static final String ALPHANUM
Alphanumeric characters
-
ALPHANUMSPECIAL
public static final String ALPHANUMSPECIAL
Alphanumeric characters and special chars
-
-
Constructor Detail
-
RandomStringUtil
public RandomStringUtil(int length, Random random, String symbols)
- Parameters:
length
- Length of the random string to be generatedrandom
- Random instance to be used to generate the random stringsymbols
- Symbols to be used to generate the random string
-
RandomStringUtil
public RandomStringUtil(int length, String symbols)
- Parameters:
length
- Length of the random string to be generatedsymbols
- Symbols to be used to generate the random string
-
RandomStringUtil
public RandomStringUtil(int length, Random random)
Create an alphanumeric string generator.- Parameters:
length
- Length of the random string to be generatedrandom
- Random instance to be used to generate the random string
-
RandomStringUtil
public RandomStringUtil(int length)
Create an alphanumeric strings from a secure generator.- Parameters:
length
- Length of the random string to be generated
-
RandomStringUtil
public RandomStringUtil()
Create session identifiers.
-
-
Method Detail
-
generateString
public String generateString()
Generate a random string.- Returns:
- a random string
-
-