bb.util
Class OsUtil.ExecTask

java.lang.Object
  extended by bb.util.OsUtil.ExecTask
All Implemented Interfaces:
Runnable
Enclosing class:
OsUtil

private static class OsUtil.ExecTask
extends Object
implements Runnable

Encapsulates all the work carried out by both the execSynch and execAsynch methods.

This class is not multithread safe: it expects to be called by the same thread over its entire life.


Field Summary
private  String command
           
private  File dir
           
private  String[] envp
           
private  StreamDrainer errDrainer
           
private  String errors
           
private  StreamDrainer outDrainer
           
private  byte[] stdOut
           
 
Constructor Summary
private OsUtil.ExecTask(String command, String[] envp, File dir, StreamDrainer outDrainer, StreamDrainer errDrainer)
           
 
Method Summary
private  String formatMsg(String label, String msg)
           
private  String getState()
           
private  byte[] getStdOut()
           
private  String needsLineEnd(String msg)
          Returns a newline if msg does not end in one, otherwise returns blank.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

command

private final String command

envp

private final String[] envp

dir

private final File dir

outDrainer

private final StreamDrainer outDrainer

errDrainer

private final StreamDrainer errDrainer

stdOut

private byte[] stdOut

errors

private String errors
Constructor Detail

OsUtil.ExecTask

private OsUtil.ExecTask(String command,
                        String[] envp,
                        File dir,
                        StreamDrainer outDrainer,
                        StreamDrainer errDrainer)
                 throws IllegalArgumentException
Throws:
IllegalArgumentException
Method Detail

run

public void run()
Specified by:
run in interface Runnable

getStdOut

private byte[] getStdOut()

getState

private String getState()

formatMsg

private String formatMsg(String label,
                         String msg)

needsLineEnd

private String needsLineEnd(String msg)
Returns a newline if msg does not end in one, otherwise returns blank.