LargeOutputReceiver
public
class
LargeOutputReceiver
extends Object
implements
IShellOutputReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.device.LargeOutputReceiver |
A class designed to help run long running commands collect output.
The maximum size of the tmp file is limited to approximately maxFileSize.
To prevent data loss when the limit has been reached, this file keeps set of tmp host
files.
Summary
Public constructors | |
|---|---|
LargeOutputReceiver(String descriptor, String serialNumber, long maxDataSize)
Creates a |
|
Public methods | |
|---|---|
void
|
addOutput(byte[] data, int offset, int length)
Called every time some new data is available. |
void
|
cancel()
Cancels the command. |
void
|
clear()
Delete currently accumulated data, and then re-create a new file. |
void
|
delete()
Delete all accumulated data. |
void
|
flush()
Called at the end of the process execution (unless the process was canceled). |
InputStreamSource
|
getData()
Gets the collected output as a |
InputStreamSource
|
getData(int maxBytes)
Gets the last maxBytes of collected output as a |
InputStreamSource
|
getData(int maxBytes, int offset)
Gets the last maxBytes of collected output as a |
boolean
|
isCancelled()
Cancel method to stop the execution of the remote shell command. |
Public constructors
LargeOutputReceiver
public LargeOutputReceiver (String descriptor,
String serialNumber,
long maxDataSize)Creates a LargeOutputReceiver.
| Parameters | |
|---|---|
descriptor |
String: the descriptor of the command to run. For logging only. |
serialNumber |
String: the serial number of the device. For logging only. |
maxDataSize |
long: the approximate max amount of data to keep. |
Public methods
addOutput
public void addOutput (byte[] data,
int offset,
int length)Called every time some new data is available.
| Parameters | |
|---|---|
data |
byte: The new data. |
offset |
int: The offset at which the new data starts. |
length |
int: The length of the new data. |
cancel
public void cancel ()
Cancels the command.
clear
public void clear ()
Delete currently accumulated data, and then re-create a new file.
delete
public void delete ()
Delete all accumulated data.
flush
public void flush ()
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.
getData
public InputStreamSource getData ()
Gets the collected output as a InputStreamSource.
| Returns | |
|---|---|
InputStreamSource |
The collected output from the command. |
getData
public InputStreamSource getData (int maxBytes)
Gets the last maxBytes of collected output as a InputStreamSource.
| Parameters | |
|---|---|
maxBytes |
int: the maximum amount of data to return. Should be an amount that can
comfortably fit in memory |
| Returns | |
|---|---|
InputStreamSource |
The collected output from the command, stored in memory |
getData
public InputStreamSource getData (int maxBytes, int offset)
Gets the last maxBytes of collected output as a InputStreamSource.
| Parameters | |
|---|---|
maxBytes |
int: the maximum amount of data to return. Should be an amount that can
comfortably fit in memory |
offset |
int: The offset of when to start getting the data from the buffer. |
| Returns | |
|---|---|
InputStreamSource |
The collected output from the command, stored in memory |
isCancelled
public boolean isCancelled ()
Cancel method to stop the execution of the remote shell command.
| Returns | |
|---|---|
boolean |
true to cancel the execution of the command. |