Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.ui
Class InteractiveShell

    java.lang.Object
      groovy.ui.InteractiveShell

All Implemented Interfaces:
  Runnable

    public class InteractiveShell

extends Object
implements Runnable

A simple interactive shell for evaluating groovy expressions on the command line (aka. groovysh).

Version:
  $Revision: 7922 $
Author:
  James Strachan, Chris Poirier, Yuri Schimke, Brian McCallistair, Guillaume Laforge, Dierk Koenig, include the inspect command, June 2005, Jason Dillon

Constructor Summary
`InteractiveShell()` Default constructor, initializes uses new binding and system streams.
`InteractiveShell(Binding binding, InputStream in, PrintStream out, PrintStream err)` Constructs a new InteractiveShell instance
`InteractiveShell(ClassLoader parent, Binding binding, InputStream in, PrintStream out, PrintStream err)` Constructs a new InteractiveShell instance
`InteractiveShell(InputStream in, PrintStream out, PrintStream err)` Constructs a new InteractiveShell instance

Method Summary
`static void` | `main(String[] args)` Entry point when called directly.
`protected String` | `read()` Reads a single statement from the command line.
`protected void` | `reset()` Resets the command-line processing machinery after use.
`void` | `run()` Reads commands and statements from input stream and processes them.
`void` | `setAfterExecution(Closure afterExecution)` A closure that is executed after the execution of the last script.
`void` | `setBeforeExecution(Closure beforeExecution)` A closure that is executed before the exection of a given script

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InteractiveShell

    public InteractiveShell()
                     throws IOException

  Default constructor, initializes uses new binding and system streams.

  Throws:
    `IOException`

### InteractiveShell

    public InteractiveShell(InputStream in,
                            PrintStream out,
                            PrintStream err)
                     throws IOException

  Constructs a new InteractiveShell instance

  Parameters:
    `in` - The input stream to use
    `out` - The output stream to use
    `err` - The error stream to use
  Throws:
    `IOException`

### InteractiveShell

    public InteractiveShell(Binding binding,
                            InputStream in,
                            PrintStream out,
                            PrintStream err)
                     throws IOException

  Constructs a new InteractiveShell instance

  Parameters:
    `binding` - The binding instance
    `in` - The input stream to use
    `out` - The output stream to use
    `err` - The error stream to use
  Throws:
    `IOException`

### InteractiveShell

    public InteractiveShell(ClassLoader parent,
                            Binding binding,
                            InputStream in,
                            PrintStream out,
                            PrintStream err)
                     throws IOException

  Constructs a new InteractiveShell instance

  Parameters:
    `parent` - The parent ClassLoader
    `binding` - The binding instance
    `in` - The input stream to use
    `out` - The output stream to use
    `err` - The error stream to use
  Throws:
    `IOException`

Method Detail

### main

    public static void main(String[] args)

  Entry point when called directly.

### run

    public void run()

  Reads commands and statements from input stream and processes them.

  Specified by:
    `run` in interface `Runnable`

### setBeforeExecution

    public void setBeforeExecution(Closure beforeExecution)

  A closure that is executed before the exection of a given script

  Parameters:
    `beforeExecution` - The closure to execute

### setAfterExecution

    public void setAfterExecution(Closure afterExecution)

  A closure that is executed after the execution of the last script. The result of the execution is passed as the first argument to the closure (the value of 'it')

  Parameters:
    `afterExecution` - The closure to execute

### reset

    protected void reset()

  Resets the command-line processing machinery after use.

### read

    protected String read()

  Reads a single statement from the command line. Also identifies and processes command shell commands. Returns the command text on success, or null when command processing is complete. NOTE: Changed, for now, to read until 'execute' is issued. At 'execute', the statement must be complete.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2008 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD