janino.net

org.codehaus.janino
Class Cookable

java.lang.Object
  extended by org.codehaus.janino.Cookable
Direct Known Subclasses:
SimpleCompiler

public abstract class Cookable
extends java.lang.Object

"Cooking" means scanning a sequence of JavaTM tokens with a Scanner and turning them into some artifact. For example, if you cook a ClassBodyEvaluator, then the tokens are interpreted as a class body and compiled into a Class which is accessible through ClassBodyEvaluator.getClazz().

This class declares numerous cook*() methods that use a String, a File, an InputStream or a Reader as the source of characters for scanning.

The cook*() methods eventually invoke the abstract cook(Scanner) method with a correctly configured Scanner.


Constructor Summary
Cookable()
           
 
Method Summary
 void cook(java.io.InputStream is)
          Cook tokens from an InputStream, encoded in the "platform default encoding".
 void cook(java.io.InputStream is, java.lang.String optionalEncoding)
           
 void cook(java.io.Reader r)
           
abstract  void cook(Scanner scanner)
          To be implemented by the derived classes.
 void cook(java.lang.String s)
          Cook tokens from a String.
 void cook(java.lang.String optionalFileName, java.io.InputStream is)
          Cook tokens from an InputStream, encoded in the "platform default encoding".
 void cook(java.lang.String optionalFileName, java.io.InputStream is, java.lang.String optionalEncoding)
           
 void cook(java.lang.String optionalFileName, java.io.Reader r)
           
 void cookFile(java.io.File file)
          Cook tokens from the given File, encoded in the "platform default encoding".
 void cookFile(java.io.File file, java.lang.String optionalEncoding)
           
 void cookFile(java.lang.String fileName)
          Cook tokens from the named file, encoded in the "platform default encoding".
 void cookFile(java.lang.String fileName, java.lang.String optionalEncoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cookable

public Cookable()
Method Detail

cook

public abstract void cook(Scanner scanner)
                   throws CompileException,
                          Parser.ParseException,
                          Scanner.ScanException,
                          java.io.IOException
To be implemented by the derived classes.

Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.io.Reader r)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.lang.String optionalFileName,
                       java.io.Reader r)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.io.InputStream is)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Cook tokens from an InputStream, encoded in the "platform default encoding".

Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.lang.String optionalFileName,
                       java.io.InputStream is)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Cook tokens from an InputStream, encoded in the "platform default encoding".

Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.io.InputStream is,
                       java.lang.String optionalEncoding)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.lang.String optionalFileName,
                       java.io.InputStream is,
                       java.lang.String optionalEncoding)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException,
                       java.io.IOException
Parameters:
optionalFileName - Used when reporting errors and warnings.
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cook

public final void cook(java.lang.String s)
                throws CompileException,
                       Parser.ParseException,
                       Scanner.ScanException
Cook tokens from a String.

Notice: If you pass a string literal, be sure to escape all JavaTM special characters, especially backslashes.

Throws:
CompileException
Parser.ParseException
Scanner.ScanException

cookFile

public final void cookFile(java.io.File file)
                    throws CompileException,
                           Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
Cook tokens from the given File, encoded in the "platform default encoding".

Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cookFile

public final void cookFile(java.io.File file,
                           java.lang.String optionalEncoding)
                    throws CompileException,
                           Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cookFile

public final void cookFile(java.lang.String fileName)
                    throws CompileException,
                           Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
Cook tokens from the named file, encoded in the "platform default encoding".

Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

cookFile

public final void cookFile(java.lang.String fileName,
                           java.lang.String optionalEncoding)
                    throws CompileException,
                           Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
Throws:
CompileException
Parser.ParseException
Scanner.ScanException
java.io.IOException

janino.net