Package org.identityconnectors.common
Class ByteUtil
- java.lang.Object
-
- org.identityconnectors.common.ByteUtil
-
public final class ByteUtil extends Object
Utility package for byte manipulation.- Since:
- 1.0
- Author:
- Will Droste
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
randomBytes()
Random array of bytes with a random length.static byte[]
randomBytes(int length)
Get a random array of bytes with the length specified.static byte[]
randomBytes(Random r)
Random array of bytes with a random length.static byte[]
randomBytes(Random r, int length)
For those that like the random bytes to be created and returned.
-
-
-
Method Detail
-
randomBytes
public static byte[] randomBytes(Random r, int length)
For those that like the random bytes to be created and returned. Uses theRandom.nextBytes(byte[])
method to generate the random data.- Parameters:
r
- to keep the same randomizer just pass it in..length
- size of the array of random data returned.- Returns:
- byte array of random data.
-
randomBytes
public static byte[] randomBytes(int length)
Get a random array of bytes with the length specified.- Parameters:
length
- the size of the byte array returned.- Returns:
- random array of bytes with the length specified.
-
randomBytes
public static byte[] randomBytes(Random r)
Random array of bytes with a random length. The length should be no greater that 4k.- Parameters:
r
- uses the randomizer provided to generate the random data.- Returns:
- a byte array no bigger than 4k filled with random data.
-
randomBytes
public static byte[] randomBytes()
Random array of bytes with a random length. The length should be no greater that 4k.- Returns:
- a byte array no bigger than 4k filled with random data.
-
-