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 LargeOutputReceiver.

Public methods

void addOutput(byte[] data, int offset, int length)

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()

InputStreamSource getData()

Gets the collected output as a InputStreamSource.

InputStreamSource getData(int maxBytes)

Gets the last maxBytes of collected output as a InputStreamSource.

boolean isCancelled()

Public constructors

LargeOutputReceiver

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

void addOutput (byte[] data, 
                int offset, 
                int length)

Parameters
data byte

offset int

length int

cancel

void cancel ()

Cancels the command.

clear

void clear ()

Delete currently accumulated data, and then re-create a new file.

delete

void delete ()

Delete all accumulated data.

flush

void flush ()

getData

InputStreamSource getData ()

Gets the collected output as a InputStreamSource.

Returns
InputStreamSource The collected output from the command.

getData

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

isCancelled

boolean isCancelled ()

Returns
boolean