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

## Class s2iProcess

    java.lang.Object
      |
      +--s2iProcess

public class s2iProcess
extends java.lang.Object
implements java.lang.Runnable

A class for running programs with a text window to show the output.

Author:
  Anish Malhotra, Cadence Design Systems

Field Summary
`private java.lang.String[]` | `cmd` The command strings to run
`private javax.swing.JTextArea` | `textArea` The text area to display output in

Constructor Summary
`s2iProcess(java.lang.String[] arg)` Construct a process with a series of commands, discarding output
`s2iProcess(java.lang.String[] arg, javax.swing.JTextArea ta)` Construct a process with a series of commands, displaying output in a text area

Method Summary
`static void` | `main(java.lang.String[] argv)` test the class.
`private static void` | `plugTogether(java.io.InputStream in, java.io.OutputStream out)` Arrange to have all input from a stream copied to another stream.
`private static void` | `plugTogether(javax.swing.JTextArea textarea, java.io.InputStream in)` Arrange to have all input from a stream printed in a text area.
`private static void` | `plugTogether(java.io.OutputStream out, java.io.InputStream in)` Arrange to have all input from a stream copied to another stream.
`void` | `run()` Run the commands.
`static java.lang.Process` | `runProg(java.lang.String cmd)` Run a single command without waiting.
`static java.lang.Process` | `runProgInTxtArea(java.lang.String cmd, javax.swing.JTextArea tArea)` Run a single command without waiting.

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

Field Detail

### cmd

    private java.lang.String[] cmd

  The command strings to run

### textArea

    private javax.swing.JTextArea textArea

  The text area to display output in

Constructor Detail

### s2iProcess

    public s2iProcess(java.lang.String[] arg)

  Construct a process with a series of commands, discarding output
  Parameters:
    `arg` - The Vector of command Strings

### s2iProcess

    public s2iProcess(java.lang.String[] arg,
                      javax.swing.JTextArea ta)

  Construct a process with a series of commands, displaying output in a text area
  Parameters:
    `arg` - The Vector of command Strings

Method Detail

### run

    public void run()

  Run the commands. This works only if a text area has been specified. Error messages are printed to stdout. This method waits for the process.
  Specified by:
    run in interface java.lang.Runnable

### runProg

    public static java.lang.Process runProg(java.lang.String cmd)
                                     throws java.io.IOException

  Run a single command without waiting. Input and out go to the console.
  Parameters:
    `cmd` - The command String to run
  Returns:
    The Process started up

### runProgInTxtArea

    public static java.lang.Process runProgInTxtArea(java.lang.String cmd,
                                                     javax.swing.JTextArea tArea)
                                              throws java.io.IOException

  Run a single command without waiting. Input and out go to the test area.
  Parameters:
    `cmd` - The command String to run
    `tArea` - The text area to display output in
  Returns:
    The Process started up

### main

    public static void main(java.lang.String[] argv)

  test the class. Each argument must be a whole command. For example:

       java s2iProcess "write s2iProcess.java"

  Runs an editor on this java file.

### plugTogether

    private static void plugTogether(javax.swing.JTextArea textarea,
                                     java.io.InputStream in)

  Arrange to have all input from a stream printed in a text area. This is done using a new thread.
  Parameters:
    `textarea` - The text area that will display output
    `in` - The input stream that is to be printed

### plugTogether

    private static void plugTogether(java.io.InputStream in,
                                     java.io.OutputStream out)

  Arrange to have all input from a stream copied to another stream. This is done using a new thread.
  Parameters:
    `in` - The input stream to copy from
    `out` - The output stream to copy to

### plugTogether

    private static void plugTogether(java.io.OutputStream out,
                                     java.io.InputStream in)

  Arrange to have all input from a stream copied to another stream. This is done using a new thread.
  Parameters:
    `out` - The output stream to copy to
    `in` - The input stream to copy from

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