com.android.ddmlib
Class CollectingOutputReceiver

java.lang.Object
  extended by com.android.ddmlib.CollectingOutputReceiver
All Implemented Interfaces:
IShellOutputReceiver

public class CollectingOutputReceiver
extends java.lang.Object
implements IShellOutputReceiver

A IShellOutputReceiver which collects the whole shell output into one String.


Constructor Summary
CollectingOutputReceiver()
           
CollectingOutputReceiver(java.util.concurrent.CountDownLatch commandCompleteLatch)
           
 
Method Summary
 void addOutput(byte[] data, int offset, int length)
          Called every time some new data is available.
 void cancel()
          Cancel the output collection
 void flush()
          Called at the end of the process execution (unless the process was canceled).
 java.lang.String getOutput()
           
 boolean isCancelled()
          Cancel method to stop the execution of the remote shell command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectingOutputReceiver

public CollectingOutputReceiver()

CollectingOutputReceiver

public CollectingOutputReceiver(java.util.concurrent.CountDownLatch commandCompleteLatch)
Method Detail

getOutput

public java.lang.String getOutput()

isCancelled

public boolean isCancelled()
Description copied from interface: IShellOutputReceiver
Cancel method to stop the execution of the remote shell command.

Specified by:
isCancelled in interface IShellOutputReceiver
Returns:
true to cancel the execution of the command.

cancel

public void cancel()
Cancel the output collection


addOutput

public void addOutput(byte[] data,
                      int offset,
                      int length)
Description copied from interface: IShellOutputReceiver
Called every time some new data is available.

Specified by:
addOutput in interface IShellOutputReceiver
Parameters:
data - The new data.
offset - The offset at which the new data starts.
length - The length of the new data.

flush

public void flush()
Description copied from interface: IShellOutputReceiver
Called at the end of the process execution (unless the process was canceled). This allows the receiver to terminate and flush whatever data was not yet processed.

Specified by:
flush in interface IShellOutputReceiver