Interface ICookable
- All Known Subinterfaces:
IClassBodyEvaluator, IExpressionEvaluator, IScriptEvaluator, ISimpleCompiler
- All Known Implementing Classes:
ClassBodyEvaluator, ClassBodyEvaluator, Cookable, ExpressionEvaluator, ExpressionEvaluator, MultiCookable, ScriptEvaluator, ScriptEvaluator, SimpleCompiler, SimpleCompiler
public interface ICookable
An entity that processes a sequence of characters (a "document"). For example, if you cook an
IClassBodyEvaluator, then the tokens are interpreted as a Java class body and compiled into a Class which
is accessible through IClassBodyEvaluator.getClazz().-
Method Summary
Modifier and TypeMethodDescriptionvoidcook(InputStream is) Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".voidcook(InputStream is, String encoding) Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.voidReads, scans, parses and compiles Java tokens from the givenReader.voidReads, scans, parses and compiles Java tokens from the givenString.voidcook(String fileName, InputStream is) Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".voidcook(String fileName, InputStream is, String encoding) Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.voidReads, scans, parses and compiles Java tokens from the givenReader.voidReads, scans, parses and compiles Java tokens from the givenString.voidReads, scans, parses and compiles Java tokens from the givenFile, encoded in the "platform default encoding".voidReads, scans, parses and compiles Java tokens from the givenFilewith the givenencoding.voidReads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".voidReads, scans, parses and compiles Java tokens from the named file with the given encoding.voidsetSourceVersion(int version) Specifies the version of source code accepted, in analogy with JAVAC's-sourcecommand line option.voidsetTargetVersion(int version) Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's-targetcommand line option.
-
Method Details
-
cook
Reads, scans, parses and compiles Java tokens from the givenReader.- Parameters:
fileName- Used when reporting errors and warnings- Throws:
CompileExceptionIOException
-
cook
Reads, scans, parses and compiles Java tokens from the givenReader.- Throws:
CompileExceptionIOException
-
cook
Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".- Throws:
CompileExceptionIOException
-
cook
Reads, scans, parses and compiles Java tokens from the givenInputStream, encoded in the "platform default encoding".- Parameters:
fileName- Used when reporting errors and warnings- Throws:
CompileExceptionIOException
-
cook
Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.- Throws:
CompileExceptionIOException
-
cook
void cook(@Nullable String fileName, InputStream is, @Nullable String encoding) throws CompileException, IOException Reads, scans, parses and compiles Java tokens from the givenInputStreamwith the givenencoding.- Parameters:
fileName- Used when reporting errors and warnings- Throws:
CompileExceptionIOException
-
cook
Reads, scans, parses and compiles Java tokens from the givenString.- Throws:
CompileException
-
cook
Reads, scans, parses and compiles Java tokens from the givenString.- Parameters:
fileName- Used when reporting errors and warnings- Throws:
CompileException
-
cookFile
Reads, scans, parses and compiles Java tokens from the givenFile, encoded in the "platform default encoding".- Throws:
CompileExceptionIOException
-
cookFile
Reads, scans, parses and compiles Java tokens from the givenFilewith the givenencoding.- Throws:
CompileExceptionIOException
-
cookFile
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".- Throws:
CompileExceptionIOException
-
cookFile
Reads, scans, parses and compiles Java tokens from the named file with the given encoding.- Throws:
CompileExceptionIOException
-
setSourceVersion
void setSourceVersion(int version) Specifies the version of source code accepted, in analogy with JAVAC's-sourcecommand line option. May be ignored by an implementation (e.g. thejaninoimplementation always accepts the language features as described on the home page). Allowed values, and the default value, depend on the implementation.-1means to use a default version. -
setTargetVersion
void setTargetVersion(int version) Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's-targetcommand line option. Allowed values depend on the implementation. The default value also depends on the implementation. The only invariant is that the generated class files are suitable for the currently executing JVM.-1means to use a default version. -
getBytecodes
- Returns:
- The generated Java bytecode; maps class name to bytes
- Throws:
IllegalStateException- This IClassBodyEvaluator is not yet cooked
-