public class OpenUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
OpenUtil.ThrowableConsumer<T> |
static interface |
OpenUtil.ThrowableFunction<T,R> |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areAllCharactersPrintable(String str)
Returns
true, when all characters of the given string are printable. |
static void |
closeQuietly(Closeable resource) |
static int |
firstNonZero(int... values)
First non-zero value or zero if none.
|
static boolean |
isCodePointPrintable(int codePoint)
Checks if a code point is printable.
|
static boolean |
isSafeFontCodePointToPrint(int codePoint)
Whether the code point should be passed through to the font
for rendering.
|
static Integer |
parseIntegerOrNull(String possibleInteger) |
static byte[] |
readAll(InputStream is) |
static String |
readAll(Reader reader) |
static String |
readString(Class<?> clazz,
String resource)
Reads a resource to a string using UTF-8.
|
static String |
readString(InputStream is)
Reads a stream to a string using UTF-8 encoding.
|
static <T> Consumer<T> |
rethrowingConsumer(OpenUtil.ThrowableConsumer<T> consumer)
Same as
rethrowingFunction(ThrowableFunction) for consumers. |
static <T,R> Function<T,R> |
rethrowingFunction(OpenUtil.ThrowableFunction<T,R> func)
Given a
OpenUtil.ThrowableFunction (which can throw checked exceptions) returns
a standard Function (which can't throw checked exceptions). |
static void |
tryQuietly(Runnable r) |
public static boolean isCodePointPrintable(int codePoint)
codePoint - public static boolean isSafeFontCodePointToPrint(int codePoint)
public static boolean areAllCharactersPrintable(String str)
true, when all characters of the given string are printable.str - a non-null string to testpublic static int firstNonZero(int... values)
public static void closeQuietly(Closeable resource)
public static void tryQuietly(Runnable r)
public static byte[] readAll(InputStream is) throws IOException
IOExceptionpublic static String readAll(Reader reader) throws IOException
IOExceptionpublic static String readString(InputStream is) throws IOException
IOExceptionpublic static String readString(Class<?> clazz, String resource) throws IOException
IOExceptionpublic static <T,R> Function<T,R> rethrowingFunction(OpenUtil.ThrowableFunction<T,R> func)
OpenUtil.ThrowableFunction (which can throw checked exceptions) returns
a standard Function (which can't throw checked exceptions).
RuntimeException
and rethrown.public static <T> Consumer<T> rethrowingConsumer(OpenUtil.ThrowableConsumer<T> consumer)
rethrowingFunction(ThrowableFunction) for consumers.Copyright © 2004–2025. All rights reserved.