Interface FuzzedDataProvider
- All Known Implementing Classes:
CannedFuzzedDataProvider
The methods defined by this interface behave similarly to Random.nextInt(), with all
returned values depending deterministically on the fuzzer input for the current run.
-
Method Summary
Modifier and TypeMethodDescriptionconsumeAsciiString(int maxLength) Consumes an ASCII-onlyStringfrom the fuzzer input.booleanConsumes abooleanfrom the fuzzer input.boolean[]consumeBooleans(int maxLength) Consumes abooleanarray from the fuzzer input.byteConsumes abytefrom the fuzzer input.byteconsumeByte(byte min, byte max) Consumes abytebetweenminandmaxfrom the fuzzer input.byte[]consumeBytes(int maxLength) Consumes abytearray from the fuzzer input.charConsumes acharfrom the fuzzer input.charconsumeChar(char min, char max) Consumes acharbetweenminandmaxfrom the fuzzer input.charConsumes acharfrom the fuzzer input that is never a UTF-16 surrogate character.doubleConsumes adoublefrom the fuzzer input.floatConsumes afloatfrom the fuzzer input.intConsumes anintfrom the fuzzer input.intconsumeInt(int min, int max) Consumes anintbetweenminandmaxfrom the fuzzer input.int[]consumeInts(int maxLength) Consumes anintarray from the fuzzer input.longConsumes alongfrom the fuzzer input.longconsumeLong(long min, long max) Consumes alongbetweenminandmaxfrom the fuzzer input.long[]consumeLongs(int maxLength) Consumes alongarray from the fuzzer input.doubleConsumes adoublebetween 0.0 and 1.0 (inclusive) from the fuzzer input.floatConsumes afloatbetween 0.0 and 1.0 (inclusive) from the fuzzer input.doubleConsumes a regulardoublefrom the fuzzer input.doubleconsumeRegularDouble(double min, double max) Consumes a regulardoublebetweenminandmaxfrom the fuzzer input.floatConsumes a regularfloatfrom the fuzzer input.floatconsumeRegularFloat(float min, float max) Consumes a regularfloatbetweenminandmaxfrom the fuzzer input.Consumes the remaining fuzzer input as an ASCII-onlyString.byte[]Consumes the remaining fuzzer input as abytearray.Consumes the remaining fuzzer input as aString.shortConsumes ashortfrom the fuzzer input.shortconsumeShort(short min, short max) Consumes ashortbetweenminandmaxfrom the fuzzer input.short[]consumeShorts(int maxLength) Consumes ashortarray from the fuzzer input.consumeString(int maxLength) Consumes aStringfrom the fuzzer input.default booleanpickValue(boolean[] array) Picks an element fromarraybased on the fuzzer input.default bytepickValue(byte[] array) Picks an element fromarraybased on the fuzzer input.default charpickValue(char[] array) Picks an element fromarraybased on the fuzzer input.default doublepickValue(double[] array) Picks an element fromarraybased on the fuzzer input.default floatpickValue(float[] array) Picks an element fromarraybased on the fuzzer input.default intpickValue(int[] array) Picks an element fromarraybased on the fuzzer input.default longpickValue(long[] array) Picks an element fromarraybased on the fuzzer input.default shortpickValue(short[] array) Picks an element fromarraybased on the fuzzer input.default <T> TpickValue(Collection<T> collection) Picks an element fromcollectionbased on the fuzzer input.default <T> TpickValue(T[] array) Picks an element fromarraybased on the fuzzer input.default <T> List<T> pickValues(Collection<T> collection, int numOfElements) PicksnumOfElementselements fromcollectionbased on the fuzzer input.default <T> List<T> pickValues(T[] array, int numOfElements) PicksnumOfElementselements fromarraybased on the fuzzer input.intReturns the number of unconsumed bytes in the fuzzer input.
-
Method Details
-
consumeBoolean
boolean consumeBoolean()Consumes abooleanfrom the fuzzer input.- Returns:
- a
boolean
-
consumeBooleans
boolean[] consumeBooleans(int maxLength) Consumes abooleanarray from the fuzzer input.The array will usually have length
length, but might be shorter if the fuzzer input is not sufficiently long.- Parameters:
maxLength- the maximum length of the array- Returns:
- a
booleanarray of length at mostlength
-
consumeByte
byte consumeByte()Consumes abytefrom the fuzzer input.- Returns:
- a
byte
-
consumeByte
byte consumeByte(byte min, byte max) Consumes abytebetweenminandmaxfrom the fuzzer input.- Parameters:
min- the inclusive lower bound on the returned valuemax- the inclusive upper bound on the returned value- Returns:
- a
bytein the range[min, max]
-
consumeBytes
byte[] consumeBytes(int maxLength) Consumes abytearray from the fuzzer input.The array will usually have length
length, but might be shorter if the fuzzer input is not sufficiently long.- Parameters:
maxLength- the maximum length of the array- Returns:
- a
bytearray of length at mostlength
-
consumeRemainingAsBytes
byte[] consumeRemainingAsBytes()Consumes the remaining fuzzer input as abytearray.Note: After calling this method, further calls to methods of this interface will return fixed values only.
- Returns:
- a
bytearray
-
consumeShort
short consumeShort()Consumes ashortfrom the fuzzer input.- Returns:
- a
short
-
consumeShort
short consumeShort(short min, short max) Consumes ashortbetweenminandmaxfrom the fuzzer input.- Parameters:
min- the inclusive lower bound on the returned valuemax- the inclusive upper bound on the returned value- Returns:
- a
shortin the range[min, max]
-
consumeShorts
short[] consumeShorts(int maxLength) Consumes ashortarray from the fuzzer input.The array will usually have length
length, but might be shorter if the fuzzer input is not sufficiently long.- Parameters:
maxLength- the maximum length of the array- Returns:
- a
shortarray of length at mostlength
-
consumeInt
int consumeInt()Consumes anintfrom the fuzzer input.- Returns:
- an
int
-
consumeInt
int consumeInt(int min, int max) Consumes anintbetweenminandmaxfrom the fuzzer input.- Parameters:
min- the inclusive lower bound on the returned valuemax- the inclusive upper bound on the returned value- Returns:
- an
intin the range[min, max]
-
consumeInts
int[] consumeInts(int maxLength) Consumes anintarray from the fuzzer input.The array will usually have length
length, but might be shorter if the fuzzer input is not sufficiently long.- Parameters:
maxLength- the maximum length of the array- Returns:
- an
intarray of length at mostlength
-
consumeLong
long consumeLong()Consumes alongfrom the fuzzer input.- Returns:
- a
long
-
consumeLong
long consumeLong(long min, long max) Consumes alongbetweenminandmaxfrom the fuzzer input.- Parameters:
min- the inclusive lower bound on the returned valuemax- the inclusive upper bound on the returned value- Returns:
- a
longin the range @{code [min, max]}
-
consumeLongs
long[] consumeLongs(int maxLength) Consumes alongarray from the fuzzer input.The array will usually have length
length, but might be shorter if the fuzzer input is not sufficiently long.- Parameters:
maxLength- the maximum length of the array- Returns:
- a
longarray of length at mostlength
-
consumeFloat
float consumeFloat()Consumes afloatfrom the fuzzer input.- Returns:
- a
floatthat may have a special value (e.g. a NaN or infinity)
-
consumeRegularFloat
float consumeRegularFloat()Consumes a regularfloatfrom the fuzzer input.- Returns:
- a
floatthat is not a special value (e.g. not a NaN or infinity)
-
consumeRegularFloat
float consumeRegularFloat(float min, float max) Consumes a regularfloatbetweenminandmaxfrom the fuzzer input.- Returns:
- a
floatin the range[min, max]
-
consumeProbabilityFloat
float consumeProbabilityFloat()Consumes afloatbetween 0.0 and 1.0 (inclusive) from the fuzzer input.- Returns:
- a
floatin the range[0.0, 1.0]
-
consumeDouble
double consumeDouble()Consumes adoublefrom the fuzzer input.- Returns:
- a
doublethat may have a special value (e.g. a NaN or infinity)
-
consumeRegularDouble
double consumeRegularDouble()Consumes a regulardoublefrom the fuzzer input.- Returns:
- a
doublethat is not a special value (e.g. not a NaN or infinity)
-
consumeRegularDouble
double consumeRegularDouble(double min, double max) Consumes a regulardoublebetweenminandmaxfrom the fuzzer input.- Returns:
- a
doublein the range[min, max]
-
consumeProbabilityDouble
double consumeProbabilityDouble()Consumes adoublebetween 0.0 and 1.0 (inclusive) from the fuzzer input.- Returns:
- a
doublein the range[0.0, 1.0]
-
consumeChar
char consumeChar()Consumes acharfrom the fuzzer input. -
consumeChar
char consumeChar(char min, char max) Consumes acharbetweenminandmaxfrom the fuzzer input.- Parameters:
min- the inclusive lower bound on the returned valuemax- the inclusive upper bound on the returned value- Returns:
- a
charin the range[min, max]
-
consumeCharNoSurrogates
char consumeCharNoSurrogates()Consumes acharfrom the fuzzer input that is never a UTF-16 surrogate character. -
consumeString
Consumes aStringfrom the fuzzer input.The returned string may be of any length between 0 and
maxLength, even if there is more fuzzer input available.- Parameters:
maxLength- the maximum length of the string- Returns:
- a
Stringof length between 0 andmaxLength(inclusive)
-
consumeRemainingAsString
String consumeRemainingAsString()Consumes the remaining fuzzer input as aString.Note: After calling this method, further calls to methods of this interface will return fixed values only.
- Returns:
- a
String
-
consumeAsciiString
Consumes an ASCII-onlyStringfrom the fuzzer input.The returned string may be of any length between 0 and
maxLength, even if there is more fuzzer input available.- Parameters:
maxLength- the maximum length of the string- Returns:
- a
Stringof length between 0 andmaxLength(inclusive) that contains only ASCII characters
-
consumeRemainingAsAsciiString
String consumeRemainingAsAsciiString()Consumes the remaining fuzzer input as an ASCII-onlyString.Note: After calling this method, further calls to methods of this interface will return fixed values only.
- Returns:
- a
Stringthat contains only ASCII characters
-
remainingBytes
int remainingBytes()Returns the number of unconsumed bytes in the fuzzer input.- Returns:
- the number of unconsumed bytes in the fuzzer input
-
pickValue
Picks an element fromcollectionbased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Type Parameters:
T- the type of the collection element- Parameters:
collection- theCollectionto pick an element from.- Returns:
- an element from
collectionchosen based on the fuzzer input
-
pickValue
default <T> T pickValue(T[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Type Parameters:
T- the type of the array element- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default boolean pickValue(boolean[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default byte pickValue(byte[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default short pickValue(short[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default int pickValue(int[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default long pickValue(long[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default double pickValue(double[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default float pickValue(float[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValue
default char pickValue(char[] array) Picks an element fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Parameters:
array- the array to pick an element from.- Returns:
- an element from
arraychosen based on the fuzzer input
-
pickValues
PicksnumOfElementselements fromcollectionbased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Type Parameters:
T- the type of the collection element- Parameters:
collection- theCollectionto pick an element from.numOfElements- the number of elements to pick.- Returns:
- an array of size
numOfElementsfromcollectionchosen based on the fuzzer input
-
pickValues
PicksnumOfElementselements fromarraybased on the fuzzer input.Note: The distribution of picks is not perfectly uniform.
- Type Parameters:
T- the type of the array element- Parameters:
array- the array to pick an element from.numOfElements- the number of elements to pick.- Returns:
- an array of size
numOfElementsfromarraychosen based on the fuzzer input
-