public class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static ResourceException |
adapt(Throwable t)
Adapts a
Throwable to a ResourceException. |
static void |
copyURLToFile(URL in,
File out) |
static Object |
deepCopy(Object source) |
static Object |
evaluateScript(Context context,
org.apache.commons.lang3.tuple.Pair<JsonPointer,ScriptEntry> scriptPair)
Executes the given script with the appropriate context information.
|
static ScriptEngineFactory |
findScriptEngineFactory(String shortName,
Iterable<ScriptEngineFactory> engineFactories) |
static String |
readFile(File file)
Read small < 5Mb text files to String.
|
static String |
readLargeFile(File file)
Read large > 5Mb text files to String.
|
static String |
readStream(InputStream stream) |
public static void copyURLToFile(URL in, File out) throws IOException
IOExceptionpublic static final String readLargeFile(File file) throws IOException
file - source filefileIOException - when the source file can not be readpublic static final String readFile(File file) throws IOException
file - source filefileIOException - when the source file can not be readpublic static final String readStream(InputStream stream) throws IOException
IOExceptionpublic static ScriptEngineFactory findScriptEngineFactory(String shortName, Iterable<ScriptEngineFactory> engineFactories)
public static Object evaluateScript(Context context, org.apache.commons.lang3.tuple.Pair<JsonPointer,ScriptEntry> scriptPair) throws ResourceException
context - scriptPair - The script to executeResourceExceptionpublic static ResourceException adapt(Throwable t)
Throwable to a ResourceException. If the
Throwable is an JSON ScriptException then an appropriate
ResourceException is returned, otherwise an
InternalServerErrorException is returned.t - The Throwable to be converted.Copyright © 2025 Open Identity Platform Community. All rights reserved.