groovy.ui
Class InteractiveShell

java.lang.Object
  extended by groovy.ui.InteractiveShell

public class InteractiveShell
extends Object

A simple interactive shell for evaluating groovy expressions on the command line

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

Constructor Summary
InteractiveShell()
          Default constructor.
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)
           
 
Method Summary
protected  void close()
           
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(String[] args)
          Reads commands and statements from input stream and processes them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractiveShell

public InteractiveShell()
Default constructor.


InteractiveShell

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

InteractiveShell

public InteractiveShell(Binding binding,
                        InputStream in,
                        PrintStream out,
                        PrintStream err)
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

InteractiveShell

public InteractiveShell(ClassLoader parent,
                        Binding binding,
                        InputStream in,
                        PrintStream out,
                        PrintStream err)
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
Method Detail

main

public static void main(String[] args)
Entry point when called directly.


run

public void run(String[] args)
         throws Exception
Reads commands and statements from input stream and processes them.

Throws:
Exception

close

protected void close()

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.



Copyright © 2003-2008 The Codehaus. All Rights Reserved.