@MinDoc(copyright="Copyright 2007, 2009 A. Weinert", author="Albrecht Weinert", version="see enclosing class AdmHelper", lastModified="see enclosing class AdmHelper", lastModifiedBy="see enclosing class AdmHelper", usage="make, run, [get streams], use, end | wait | forget", purpose="a handler / wrapper for processes / child applications") public static class AdmHelper.OSexec extends Object
AdmHelper
Modifier and Type | Field and Description |
---|---|
String |
command
Process designation.
|
static int |
DESTROYED
State value (instead / before return code).
|
static int |
NO_START_POSSIBLE
State value (instead / before return code).
|
static int |
NOT_STARTET
State value (instead / before return code).
|
static int |
STARTET
State value (instead / before return code).
|
static int |
STARTET_VIACMD
State value (instead / before return code).
|
static byte[] |
STOPP_PLEASE
Some common stop commands (and ETX).
|
Constructor and Description |
---|
OSexec(String[] args)
Making an process environment.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the process.
|
String |
doStart()
Start.
|
int |
exitCode(int wait)
The process's return value.
|
String |
getErr(String encoding)
Error output as (one) String.
|
String |
getNorm(String encoding)
Normal output as (one) String.
|
Process |
getProcess()
The process.
|
OutputStream |
getToN()
The output stream = input to the process.
|
boolean |
isReady()
Ready / done.
|
boolean |
outputAvailable()
The process did deliver some output.
|
boolean |
sendToPr(byte[] b)
Send a character sequence (as bytes) to the process's normal input.
|
public static final byte[] STOPP_PLEASE
STOPP_PLEASE
may be used as last trial "in peace" to
end the programme before just killing the process by
destroy()
.sendToPr(byte[])
,
destroy()
public static final int NOT_STARTET
public static final int STARTET
public static final int STARTET_VIACMD
public static final int NO_START_POSSIBLE
public static final int DESTROYED
public final String command
public OSexec(String[] args) throws IllegalArgumentException
args
. At least
one denotation of the process, like "doWhat.bat" must
remain.args
- [0] = process denotation; [1... parameterIllegalArgumentException
- process denotation is missingpublic final boolean isReady()
public Process getProcess()
public OutputStream getToN()
OutputStream
).public boolean sendToPr(byte[] b)
STOPP_PLEASE
public String doStart()
public int exitCode(int wait)
wait
- if > 10 waiting time in msSTARTET
,
STARTET_VIACMD
,
NOT_STARTET
,
NO_START_POSSIBLE
public boolean outputAvailable()
public String getNorm(String encoding) throws UnsupportedEncodingException, IOException
encoding
- for the output (character set)IOException
- file or stream problemsUnsupportedEncodingException
- wrong encodingpublic String getErr(String encoding) throws UnsupportedEncodingException, IOException
encoding
- for the output (character set)IOException
- file or stream problemsUnsupportedEncodingException
- wrong encodingpublic void destroy()