Class UnicodeGenerator
java.lang.Object
com.carrotsearch.randomizedtesting.generators.StringGenerator
com.carrotsearch.randomizedtesting.generators.UnicodeGenerator
A string generator that emits valid unicodeGenerator codepoints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionofCodePointsLength
(Random r, int minCodePoints, int maxCodePoints) ofCodeUnitsLength
(Random r, int minCodeUnits, int maxCodeUnits) ofUtf8Length
(Random r, int minUtf8Length, int maxUtf8Length) Returns a random string that will have a random UTF-8 representation length betweenminUtf8Length
andmaxUtf8Length
.Methods inherited from class com.carrotsearch.randomizedtesting.generators.StringGenerator
ofStringLength
-
Field Details
-
SURROGATE_RANGE
private static final int SURROGATE_RANGE- See Also:
-
CODEPOINT_RANGE
private static final int CODEPOINT_RANGE- See Also:
-
-
Constructor Details
-
UnicodeGenerator
public UnicodeGenerator()
-
-
Method Details
-
ofCodeUnitsLength
- Specified by:
ofCodeUnitsLength
in classStringGenerator
- Parameters:
minCodeUnits
- Minimum number of code units (inclusive).maxCodeUnits
- Maximum number of code units (inclusive).- Returns:
- Returns a string of variable length between
minCodeUnits
(inclusive) andmaxCodeUnits
(inclusive) length. Code units are essentially an equivalent ofchar
type, seeString
class for explanation.
-
ofCodePointsLength
- Specified by:
ofCodePointsLength
in classStringGenerator
- Parameters:
minCodePoints
- Minimum number of code points (inclusive).maxCodePoints
- Maximum number of code points (inclusive).- Returns:
- Returns a string of variable length between
minCodePoints
(inclusive) andmaxCodePoints
(inclusive) length. Code points are full unicodeGenerator codepoints or an equivalent ofint
type, seeString
class for explanation. The returnedString.length()
may exceedmaxCodeUnits
because certain code points may be encoded as surrogate pairs.
-
ofUtf8Length
Returns a random string that will have a random UTF-8 representation length betweenminUtf8Length
andmaxUtf8Length
.- Parameters:
minUtf8Length
- Minimum UTF-8 representation length (inclusive).maxUtf8Length
- Maximum UTF-8 representation length (inclusive).
-