Package org.apereo.cas.util.gen
Interface RandomStringGenerator
-
- All Known Implementing Classes:
AbstractRandomStringGenerator,Base64RandomStringGenerator,DefaultRandomNumberGenerator,DefaultRandomStringGenerator,HexRandomStringGenerator
public interface RandomStringGeneratorInterface to return a random String.- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_LENGTHThe default length.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetAlgorithm()The algorithm used by the generator's SecureRandom instance.longgetDefaultLength()Default length to use.java.lang.StringgetNewString()A new random string of specified default size.java.lang.StringgetNewString(int size)A new random string of specified initial size.byte[]getNewStringAsBytes(int size)Gets the new string as bytes.
-
-
-
Field Detail
-
DEFAULT_LENGTH
static final int DEFAULT_LENGTH
The default length.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultLength
long getDefaultLength()
Default length to use.- Returns:
- the default length as an int.
-
getAlgorithm
java.lang.String getAlgorithm()
The algorithm used by the generator's SecureRandom instance.- Returns:
- the algorithm used by the generator's SecureRandom instance.
-
getNewString
java.lang.String getNewString(int size)
A new random string of specified initial size.- Parameters:
size- length of random string before encoding- Returns:
- a new random string of specified initial size
-
getNewString
java.lang.String getNewString()
A new random string of specified default size.- Returns:
- a new random string of default initial size
-
getNewStringAsBytes
byte[] getNewStringAsBytes(int size)
Gets the new string as bytes.- Parameters:
size- the size of return- Returns:
- the new random string as bytes
-
-