FixedByteArrayOutputStream

public class FixedByteArrayOutputStream
extends OutputStream

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


An in-memory 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

FixedByteArrayOutputStream (int maxDataSize)

Creates a FixedByteArrayOutputStream.

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

Public methods

getData

InputStream getData ()

Gets a InputStream for reading collected output.

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

Returns
InputStream

size

long size ()

Returns
long the number of bytes currently stored.

write

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

Parameters
b byte

off int

len int

Throws
IOException

write

void write (int data)

Parameters
data int

Throws
IOException