public final class ParserUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(java.lang.String s1,
java.lang.String s2) |
static java.nio.file.Path |
createTempDir(java.lang.String prefix) |
static java.nio.file.Path |
createTempFile(java.lang.String prefix,
java.lang.String suffix) |
static java.lang.Class<?> |
forName(java.lang.String className)
|
static java.net.URL |
getResource(java.lang.String streamPath)
Class.getResource(String) using the context ClassLoader
specified in setContext(ClassLoader) if any. |
static boolean |
parseBool(java.lang.String name) |
static double |
parseDouble(java.lang.String string)
References: Float.parseFloat is slow
(implementation fixed and unit-tested) |
static float |
parseFloat(java.lang.String string) |
static int |
parseInt(java.lang.String string)
References: StackOverflow: 'Most efficient way of converting String to Integer in java'
|
static long |
parseLong(java.lang.String string) |
static java.lang.String |
parseString(java.lang.String s) |
static void |
setContext(java.lang.ClassLoader context)
Usage:
ParserUtils.setContext(classLoader);
// Do stuff that potentially uses the context ClassLoader
[...] |
static void |
setTempFileDir(java.nio.file.Path dir) |
static java.lang.Float |
toFloat(java.lang.Object value) |
static java.lang.Integer |
toInt(java.lang.Object value) |
static java.io.IOException |
toIOException(java.lang.String message,
java.lang.Throwable t) |
static java.io.IOException |
toIOException(java.lang.Throwable t) |
static void |
yield() |
static void |
yield(int timeOutMS) |
public static final void setContext(java.lang.ClassLoader context)
ParserUtils.setContext(classLoader);
// Do stuff that potentially uses the context ClassLoader
[...]
ParserUtils.setContext(null);context - the ClassLoader context of the current thread.forName(String)public static final java.lang.Class<?> forName(java.lang.String className)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionClass.forName(String)public static final java.net.URL getResource(java.lang.String streamPath)
Class.getResource(String) using the context ClassLoader
specified in setContext(ClassLoader) if any.Class.getResource(String)public static final java.lang.String parseString(java.lang.String s)
public static final int parseInt(java.lang.String string)
string - a String containing an intjava.lang.NumberFormatExceptionpublic static final long parseLong(java.lang.String string)
public static final float parseFloat(java.lang.String string)
public static final double parseDouble(java.lang.String string)
public static final boolean parseBool(java.lang.String name)
public static java.lang.Integer toInt(java.lang.Object value)
public static java.lang.Float toFloat(java.lang.Object value)
public static final int compare(java.lang.String s1,
java.lang.String s2)
public static final java.io.IOException toIOException(java.lang.Throwable t)
public static final java.io.IOException toIOException(java.lang.String message,
java.lang.Throwable t)
public static final java.nio.file.Path createTempFile(java.lang.String prefix,
java.lang.String suffix)
throws java.io.IOException
java.io.IOExceptionpublic static final java.nio.file.Path createTempDir(java.lang.String prefix)
throws java.io.IOException
java.io.IOExceptionpublic static final void setTempFileDir(java.nio.file.Path dir)
dir - file creation directory, or null to use defaultpublic static final void yield()
public static final void yield(int timeOutMS)
Bonzai Engine 1.4.1-20200831 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2019 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com