public class Do
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Do.Action
Interface to single method with no parameters throwing exception.
|
static interface |
Do.Task<T> |
static interface |
Do.TaskWithoutResult |
| Constructor and Description |
|---|
Do() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
bytesToHex(byte[] bytes) |
static <A,B> A |
checkSame(A oldValue,
B newValue,
java.lang.Runnable onChanged) |
static <T> java.util.Collection<T> |
collection(java.lang.Object x) |
static byte[] |
decodeBase64(java.lang.String base64) |
static boolean |
deepEqualityTest(java.lang.Object a,
java.lang.Object b) |
static void |
delay(long millis,
Do.Action action) |
static java.security.SecureRandom |
getRng() |
static DeferredResult |
inParallel(Do.Task task)
Immediately start specified task (e.g.
|
static DeferredResult |
inParallel(Do.TaskWithoutResult task) |
static void |
later(Do.Action action) |
static <T,U> java.util.ArrayList<T> |
list(U x)
Convert native array or some collection fo list
|
static <T,U> java.util.ArrayList<T> |
listOf(U... objects) |
static java.util.HashMap<java.lang.String,java.lang.Object> |
map(java.lang.Object... args)
Convert "key, value" pairs from varargs into a Map.
|
static byte[] |
randomBytes(int length)
Get a sequence of random bytes using SecureRandom.
|
static int |
randomInt(int max)
get the next integer in [0,max[ (max exclusive, zero inclusive) range using
SecureRandom generator |
static int |
randomIntInRange(int inclusiveMinimum,
int inclusiveMaximum) |
static byte[] |
randomNegativeBytes(int length)
Get a sequence of random negative bytes using SecureRandom, useful to test errors
|
static byte[] |
read(java.io.File f) |
static byte[] |
read(java.io.InputStream inputStream) |
static byte[] |
read(java.lang.String fileName) |
static java.lang.String |
readToString(java.io.InputStream inputStream) |
static <T> T |
sample(java.util.Collection source)
Get a random item of the collection.
|
static java.lang.String |
snakeToCamelCase(java.lang.String snakeString)
Convert a snake_case_string to CamelCaseString.
|
public static byte[] read(java.lang.String fileName)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] read(java.io.InputStream inputStream)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readToString(java.io.InputStream inputStream)
throws java.io.IOException
java.io.IOExceptionpublic static <A,B> A checkSame(A oldValue,
B newValue,
java.lang.Runnable onChanged)
public static <T> T sample(java.util.Collection source)
RandomAccess enablied List collections.
For other types of collections converts i to an array which might require further optimization.source - collectionpublic static java.security.SecureRandom getRng()
public static int randomInt(int max)
SecureRandom generatormax - public static byte[] randomBytes(int length)
length - array lengthpublic static byte[] randomNegativeBytes(int length)
length - array lengthpublic static int randomIntInRange(int inclusiveMinimum,
int inclusiveMaximum)
public static byte[] read(java.io.File f)
throws java.io.IOException
java.io.IOExceptionpublic static void delay(long millis,
Do.Action action)
public static void later(Do.Action action)
public static java.util.HashMap<java.lang.String,java.lang.Object> map(java.lang.Object... args)
args - key, value pairs.Can be 0 length or any even length.public static <T> java.util.Collection<T> collection(java.lang.Object x)
public static <T,U> java.util.ArrayList<T> list(U x)
x - array, collection or a listpublic static <T,U> java.util.ArrayList<T> listOf(U... objects)
public static boolean deepEqualityTest(java.lang.Object a,
java.lang.Object b)
public static byte[] decodeBase64(java.lang.String base64)
public static DeferredResult inParallel(Do.Task task)
DeferredResult to get the results. Meant to start operations that have to be done in
parallel.task - to performpublic static DeferredResult inParallel(Do.TaskWithoutResult task)
public static java.lang.String bytesToHex(byte[] bytes)
public static java.lang.String snakeToCamelCase(java.lang.String snakeString)
snakeString -