FixedByteArrayOutputStream

public class FixedByteArrayOutputStream
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.FixedByteArrayOutputStream


An in-memory ERROR(/OutputStream) that only keeps a maximum amount of data.

This is implemented by keeping a circular byte array of fixed size.

Not thread safe.

Summary

Public constructors

FixedByteArrayOutputStream(int maxDataSize)

Creates a FixedByteArrayOutputStream.

Public methods

InputStream getData()

Gets a InputStream for reading collected output.

long size()
void write(byte[] b, int off, int len)
void write(int data)

Public constructors

FixedByteArrayOutputStream

public FixedByteArrayOutputStream (int maxDataSize)

Creates a FixedByteArrayOutputStream.

Parameters
maxDataSize int: the approximate max size in bytes to keep in the output stream

Public methods

getData

public InputStream getData ()

Gets a InputStream for reading collected output.

Not thread safe. Assumes no data will be written while being read

Returns
InputStream

size

public long size ()

Returns
long the number of bytes currently stored.

write

public void write (byte[] b, 
                int off, 
                int len)

Parameters
b byte

off int

len int

write

public void write (int data)

Parameters
data int