|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.process.ProcessRunner
public class ProcessRunner
Used to run process in as safe a manner as possible.
The Java process API, while very simple, contains a lot of pitfalls and requires some work to use properly. Typical errors are forgetting to monitor a process' output streams, which will make it deadlock more often than not.
Using the ProcessRunner will take care of all these tasks, while still allowing most of the flexibility
of the standard API.
| Method Summary | |
|---|---|
static AbstractProcess |
execute(java.lang.String command)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String[] tokens)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
AbstractFile currentDirectory)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
ProcessListener listener)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
ProcessListener listener,
java.lang.String encoding)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
java.lang.String encoding)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
ProcessListener listener)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
ProcessListener listener,
java.lang.String encoding)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String[] tokens,
java.lang.String encoding)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String command,
AbstractFile currentDirectory)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String command,
AbstractFile currentDirectory,
ProcessListener listener)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String command,
AbstractFile currentDirectory,
ProcessListener listener,
java.lang.String encoding)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String command,
AbstractFile currentDirectory,
java.lang.String encoding)
Executes the specified command in the specified directory. |
static AbstractProcess |
execute(java.lang.String command,
ProcessListener listener)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String command,
ProcessListener listener,
java.lang.String encoding)
Executes the specified command in the VM's current directory. |
static AbstractProcess |
execute(java.lang.String command,
java.lang.String encoding)
Executes the specified command in the VM's current directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static AbstractProcess execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
ProcessListener listener,
java.lang.String encoding)
throws java.io.IOException
Note that both currentDirectory and listener can be set to null.
If no current directory is specified, the VM's current directory will be used. Moreover, if the current directory
is not on a file system that supports process running, the user's home directory will be used instead.
If listener is set to null, nobody will be notified of the process' state. Its streams
will still be emptied to prevent deadlocks.
tokens - tokens that compose the command to execute.currentDirectory - directory in which to execute the process (user directory if null).listener - object that will be notified of modifications in the process' state (ignored if null).encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if any error occurs while creating the process.
public static AbstractProcess execute(java.lang.String command,
AbstractFile currentDirectory,
ProcessListener listener)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, currentDirectory, listener, null).
command - command to execute.currentDirectory - directory in which to execute the process (user directory if null).listener - object that will be notified of modifications in the process' state (ignored if null).
java.io.IOException - thrown if any error occurs while creating the process.
public static AbstractProcess execute(java.lang.String command)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, null, null, null).
command - command to execute.
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, null, null, encoding).
command - command to execute.encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
ProcessListener listener)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, null, listener, null).
command - command to execute.listener - object that will be notified of any modification in the process' state (ignored if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
ProcessListener listener,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, null, listener, encoding).
command - command to execute.listener - object that will be notified of any modification in the process' state.encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
AbstractFile currentDirectory)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, currentDirectory, null, null).
command - command to execute.currentDirectory - directory in which to run the command.
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
AbstractFile currentDirectory,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(command, currentDirectory, null, encoding).
command - command to execute.currentDirectory - directory in which to run the command (uses the VM's current directory if null).encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String,AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String command,
AbstractFile currentDirectory,
ProcessListener listener,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, currentDirectory, null, encoding) where tokens
is an array contains all the tokens found in command.
More precisely, the command string is broken into tokens using a StringTokenizer created by the call
new StringTokenizer(command) with no further modification of the character categories. The tokens produced by the
tokenizer are then placed in the new string array tokens, in the same order.
command - command to execute.currentDirectory - directory in which to run the command (uses the VM's current directory if null).encoding - encoding used to read from the process' stream (system default is used if null).listener - object that will be notified of modifications in the process' state (ignored if null).
java.io.IOException - thrown if an error happens while starting the process.
public static AbstractProcess execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
ProcessListener listener)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, currentDirectory, listener, null).
tokens - command to execute.currentDirectory - directory in which to run the command (uses the VM's current directory if null).listener - object that will be notified of any modification in the process' state.
java.io.IOException - thrown if an error happens while starting the process.
public static AbstractProcess execute(java.lang.String[] tokens)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, null, null, null).
tokens - command to execute.
java.io.IOException - thrown if an error happens while starting the process.
public static AbstractProcess execute(java.lang.String[] tokens,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, null, null, encoding).
tokens - command to execute.encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.
public static AbstractProcess execute(java.lang.String[] tokens,
ProcessListener listener)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, null, listener, null).
tokens - command to execute.listener - object that will be notified of any modification in the process' state (ignored if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String[],AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String[] tokens,
ProcessListener listener,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, null, listener, encoding).
tokens - command to execute.listener - object that will be notified of any modification in the process' state (ignored if null).encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String[],AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String[] tokens,
AbstractFile currentDirectory)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, currentDirectory, null, null).
tokens - command to execute.currentDirectory - directory in which to run the command.
java.io.IOException - thrown if an error happens while starting the process.execute(String[],AbstractFile,ProcessListener,String)
public static AbstractProcess execute(java.lang.String[] tokens,
AbstractFile currentDirectory,
java.lang.String encoding)
throws java.io.IOException
This is a convenience method and behaves exactly as a call to execute(tokens, currentDirectory, null, null).
tokens - command to execute.currentDirectory - directory in which to run the command.encoding - encoding used to read from the process' stream (system default is used if null).
java.io.IOException - thrown if an error happens while starting the process.execute(String[],AbstractFile,ProcessListener,String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard