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.

InputStreamSource getData(int maxBytes, int offset)

Gets the last maxBytes of collected output as a InputStreamSource.

boolean isCancelled()

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)

Parameters
data byte

offset int

length int

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

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

Returns
boolean