Package org.codehaus.commons.compiler

# 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 Type
Method
Description
`void`
`cook(InputStream is)`
Reads, scans, parses and compiles Java tokens from the given `InputStream`, encoded in the "platform default encoding".
`void`
`cook(InputStream is, String encoding)`
Reads, scans, parses and compiles Java tokens from the given `InputStream` with the given `encoding`.
`void`
`cook(Reader r)`
Reads, scans, parses and compiles Java tokens from the given `Reader`.
`void`
`cook(String s)`
Reads, scans, parses and compiles Java tokens from the given `String`.
`void`
`cook(String fileName, InputStream is)`
Reads, scans, parses and compiles Java tokens from the given `InputStream`, encoded in the "platform default encoding".
`void`
`cook(String fileName, InputStream is, String encoding)`
Reads, scans, parses and compiles Java tokens from the given `InputStream` with the given `encoding`.
`void`
`cook(String fileName, Reader r)`
Reads, scans, parses and compiles Java tokens from the given `Reader`.
`void`
`cook(String fileName, String s)`
Reads, scans, parses and compiles Java tokens from the given `String`.
`void`
`cookFile(File file)`
Reads, scans, parses and compiles Java tokens from the given `File`, encoded in the "platform default encoding".
`void`
`cookFile(File file, String encoding)`
Reads, scans, parses and compiles Java tokens from the given `File` with the given `encoding`.
`void`
`cookFile(String fileName)`
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".
`void`
`cookFile(String fileName, String encoding)`
Reads, scans, parses and compiles Java tokens from the named file with the given encoding.
`Map<String,byte[]>`
`getBytecodes()`
`void`
`setSourceVersion(int version)`
Specifies the version of source code accepted, in analogy with JAVAC's `-source` command line option.
`void`
`setTargetVersion(int version)`
Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's `-target` command line option.

## Method Details

### cook

void cook(@Nullable String fileName, Reader r) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `Reader`.

Parameters:
  `fileName` - Used when reporting errors and warnings
Throws:
  `CompileException`
  `IOException`

### cook

void cook(Reader r) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `Reader`.

Throws:
  `CompileException`
  `IOException`

### cook

void cook(InputStream is) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `InputStream`, encoded in the "platform default encoding".

Throws:
  `CompileException`
  `IOException`

### cook

void cook(@Nullable String fileName, InputStream is) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `InputStream`, encoded in the "platform default encoding".

Parameters:
  `fileName` - Used when reporting errors and warnings
Throws:
  `CompileException`
  `IOException`

### cook

void cook(InputStream is, @Nullable String encoding) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `InputStream` with the given `encoding`.

Throws:
  `CompileException`
  `IOException`

### cook

void cook(@Nullable String fileName, InputStream is, @Nullable String encoding) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `InputStream` with the given `encoding`.

Parameters:
  `fileName` - Used when reporting errors and warnings
Throws:
  `CompileException`
  `IOException`

### cook

void cook(String s) throws CompileException
Reads, scans, parses and compiles Java tokens from the given `String`.

Throws:
  `CompileException`

### cook

void cook(@Nullable String fileName, String s) throws CompileException
Reads, scans, parses and compiles Java tokens from the given `String`.

Parameters:
  `fileName` - Used when reporting errors and warnings
Throws:
  `CompileException`

### cookFile

void cookFile(File file) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `File`, encoded in the "platform default encoding".

Throws:
  `CompileException`
  `IOException`

### cookFile

void cookFile(File file, @Nullable String encoding) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the given `File` with the given `encoding`.

Throws:
  `CompileException`
  `IOException`

### cookFile

void cookFile(String fileName) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".

Throws:
  `CompileException`
  `IOException`

### cookFile

void cookFile(String fileName, @Nullable String encoding) throws CompileException, IOException
Reads, scans, parses and compiles Java tokens from the named file with the given encoding.

Throws:
  `CompileException`
  `IOException`

### setSourceVersion

void setSourceVersion(int version)
Specifies the version of source code accepted, in analogy with JAVAC's `-source` command line option. May be ignored by an implementation (e.g. the `janino` implementation always accepts the language features as described on the home page). Allowed values, and the default value, depend on the implementation. `-1` means 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 `-target` command 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. `-1` means to use a default version.

### getBytecodes

Map<String,byte[]> getBytecodes()

Returns:
  The generated Java bytecode; maps class name to bytes
Throws:
  `IllegalStateException` - This IClassBodyEvaluator is not yet cooked