public class Utils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Utils.ThrowingConsumer<T,E extends java.lang.Throwable> |
static interface |
Utils.ThrowingFunction<T,R,E extends java.lang.Throwable> |
static interface |
Utils.ThrowingProducer<T,E extends java.lang.Throwable> |
static interface |
Utils.ThrowingRunnable<E extends java.lang.Throwable> |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(java.io.InputStream is,
java.io.OutputStream os)
Copies the content of an InputStream to an OutputStream.
|
static void |
deleteFolder(java.io.File directory)
Deletes the given directory and all containing files.
|
static void |
deleteFolder(java.nio.file.Path folder) |
static java.lang.String |
ensureStartsWith(char start,
java.lang.String str) |
static java.lang.String |
ensureStartsWith(java.lang.String start,
java.lang.String str) |
static java.util.Map<java.lang.String,java.nio.file.Path> |
indexChildren(java.nio.file.Path toIndex) |
static java.util.Map<java.lang.String,java.nio.file.Path> |
indexChildren(java.nio.file.Path toIndex,
java.lang.String prefix) |
static java.nio.file.Path |
makeParentDirs(java.nio.file.Path path) |
static java.io.InputStream |
protectClose(java.io.InputStream is) |
static java.io.OutputStream |
protectClose(java.io.OutputStream os) |
static java.util.List<java.lang.String> |
readAll(byte[] bytes) |
static <T> java.util.function.Consumer<T> |
sneakC(Utils.ThrowingConsumer<T,java.lang.Throwable> tc) |
static <T,R> java.util.function.Function<T,R> |
sneakF(Utils.ThrowingFunction<T,R,java.lang.Throwable> tf) |
static java.lang.Runnable |
sneakR(Utils.ThrowingRunnable<java.lang.Throwable> tr) |
static <T> T |
sneaky(Utils.ThrowingProducer<T,java.lang.Throwable> tp) |
static void |
sneaky(Utils.ThrowingRunnable<java.lang.Throwable> tr) |
static java.lang.String |
stripStart(char start,
java.lang.String str) |
static java.lang.String |
stripStart(java.lang.String start,
java.lang.String str) |
static <T extends java.lang.Throwable> |
throwUnchecked(java.lang.Throwable t)
Throws an exception without compiler warnings.
|
static byte[] |
toBytes(java.io.InputStream is)
Reads an InputStream to a byte array.
|
public static void copy(java.io.InputStream is,
java.io.OutputStream os)
throws java.io.IOException
is - The InputStream.os - The OutputStream.java.io.IOException - If something is bork.public static byte[] toBytes(java.io.InputStream is)
throws java.io.IOException
is - The InputStream.java.io.IOException - If something is bork.public static java.util.List<java.lang.String> readAll(byte[] bytes)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String stripStart(char start,
java.lang.String str)
public static java.lang.String stripStart(java.lang.String start,
java.lang.String str)
public static java.lang.String ensureStartsWith(char start,
java.lang.String str)
public static java.lang.String ensureStartsWith(java.lang.String start,
java.lang.String str)
public static java.io.InputStream protectClose(java.io.InputStream is)
public static java.io.OutputStream protectClose(java.io.OutputStream os)
public static void deleteFolder(java.io.File directory)
directory - The directory to delete.public static void deleteFolder(java.nio.file.Path folder)
throws java.io.IOException
java.io.IOExceptionpublic static java.nio.file.Path makeParentDirs(java.nio.file.Path path)
public static java.lang.Runnable sneakR(Utils.ThrowingRunnable<java.lang.Throwable> tr)
public static <T,R> java.util.function.Function<T,R> sneakF(Utils.ThrowingFunction<T,R,java.lang.Throwable> tf)
public static <T> java.util.function.Consumer<T> sneakC(Utils.ThrowingConsumer<T,java.lang.Throwable> tc)
public static void sneaky(Utils.ThrowingRunnable<java.lang.Throwable> tr)
public static <T> T sneaky(Utils.ThrowingProducer<T,java.lang.Throwable> tp)
public static <T extends java.lang.Throwable> void throwUnchecked(java.lang.Throwable t)
throws T extends java.lang.Throwable
T extends java.lang.Throwablepublic static java.util.Map<java.lang.String,java.nio.file.Path> indexChildren(java.nio.file.Path toIndex)
throws java.io.IOException
java.io.IOExceptionpublic static java.util.Map<java.lang.String,java.nio.file.Path> indexChildren(java.nio.file.Path toIndex,
java.lang.String prefix)
throws java.io.IOException
java.io.IOException