Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/main/java/com/googlecode/aviator/AviatorEvaluatorInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,41 @@ public Expression compileScript(final String path) throws IOException {
return this.compileScript(path, this.cachedExpressionByDefault);
}

/**
* Compile a script into expression.
*
* @param cacheKey caching key when cached is true.
* @param in the script file's InputStream
* @param name source file name
* @return the compiled expression instance.
* @throws IOException
* @since 5.0.0
*/
public Expression compileScript(final String cacheKey, final InputStream in,
final String name)
throws IOException {
return this.compileScript(cacheKey, in, name, this.cachedExpressionByDefault);
}

/**
* Compile a script into expression.
*
* @param cacheKey caching key when cached is true.
* @param in the script file's InputStream
* @param name source file name
* @param cached whether to cache the expression instance by cacheKey.
* @return the compiled expression instance.
* @throws IOException
* @since 5.0.0
*/
public Expression compileScript(final String cacheKey, final InputStream in,
final String name, final boolean cached)
throws IOException {
Reader reader = new InputStreamReader(in, Charset.forName("utf-8"));
return compile(cacheKey, Utils.readFully(reader), name, cached);
}


/**
* Returns the function missing handler, null if not set.
*
Expand Down