|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.entityfs.support.io.AbstractCommands
public abstract class AbstractCommands
This is an abstract class that command class implementations can inherit. It contains methods for running external commands.
Constructor Summary | |
---|---|
protected |
AbstractCommands(LogAdapterHolder lah)
Constructor. |
Method Summary | |
---|---|
protected Process |
execAndWait(String cmd)
Execute an external command, such as ls and wait for it to
complete. |
protected String |
getErrorMessage(Process p,
String cmd)
Create an error message from the error message from a process. |
protected LogAdapter |
getLogAdapter()
Get the file system's current log adapter. |
protected String |
getOutput(InputStream is)
Get the output from a stream, for instance from the output of a process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractCommands(LogAdapterHolder lah)
lah
- The file system's log adapter holder.Method Detail |
---|
protected LogAdapter getLogAdapter()
protected Process execAndWait(String cmd) throws InterruptedException
ls
and wait for it to
complete.
This does not work if the command generates a lot of output because the
process' output buffers are limited in size. In that case the running
process' output must be regularly read to keep it from stalling. See
Process
.
cmd
- The command to run
Process
object for the completed process.
InterruptedException
- If the command was interrupted.protected String getOutput(InputStream is)
is
- The stream to read from. The stream is closed by this method.
protected String getErrorMessage(Process p, String cmd)
0
.
p
- The process that generated an error.cmd
- The command that failed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |