uvascript
Class Task

java.lang.Object
  extended byuvascript.Task

public class Task
extends java.lang.Object

A process running an external command.


Constructor Summary
Task(java.lang.String cmd)
          Creates a new process.
Task(java.lang.String[] cmd)
          Creates a new process.
 
Method Summary
 Task dir(java.io.File f)
          Sets the working directory.
 Task env(java.lang.String[] e)
          Sets the environment variables.
 Task err(java.io.File file)
          Redirects the standard error stream to the specified file.
 Task err(java.lang.String fileName)
          Redirects the standard error stream to the specified file.
 Task in(java.io.File file)
          Redirects the standard input stream to the specified file.
 Task in(java.lang.String fileName)
          Redirects the standard input stream to the specified file.
 Task out(java.io.File file)
          Redirects the standard output stream to the specified file.
 Task out(java.lang.String fileName)
          Redirects the standard output stream to the specified file.
 Task pipe(java.lang.String cmd)
          Creates a new process and connects the standard output stream of this process to the standard input stream of that new proces.
 Task pipe(java.lang.String[] cmds)
          Creates a new process and connects the standard output stream of this process to the standard input stream of that new proces.
 int run()
          Starts the process.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Task

public Task(java.lang.String[] cmd)
Creates a new process.

Parameters:
cmd - an array containing the command name and the arguments.

Task

public Task(java.lang.String cmd)
Creates a new process.

Parameters:
cmd - the command line.
Method Detail

in

public Task in(java.lang.String fileName)
Redirects the standard input stream to the specified file.

Returns:
this object.

in

public Task in(java.io.File file)
Redirects the standard input stream to the specified file.

Returns:
this object.

out

public Task out(java.lang.String fileName)
Redirects the standard output stream to the specified file.

Returns:
this object.

out

public Task out(java.io.File file)
Redirects the standard output stream to the specified file.

Returns:
this object.

pipe

public Task pipe(java.lang.String[] cmds)
Creates a new process and connects the standard output stream of this process to the standard input stream of that new proces.

Parameters:
cmds - an array containing the command name and the arguments.
Returns:
the process created.

pipe

public Task pipe(java.lang.String cmd)
Creates a new process and connects the standard output stream of this process to the standard input stream of that new proces.

Returns:
the process created.

err

public Task err(java.lang.String fileName)
Redirects the standard error stream to the specified file.

Returns:
this object.

err

public Task err(java.io.File file)
Redirects the standard error stream to the specified file.

Returns:
this object.

dir

public Task dir(java.io.File f)
Sets the working directory.

Returns:
this object.

env

public Task env(java.lang.String[] e)
Sets the environment variables.

Parameters:
e - each element is in format name=value.
Returns:
this object.

run

public int run()
Starts the process.

Returns:
the exit status. It is zero if the process normally terminates.


UvaScript. Copyright (C) 2004 Shigeru Chiba. All Rights Reserved.