SnapshotInputStreamSource

public class SnapshotInputStreamSource
extends Object implements InputStreamSource

java.lang.Object
   ↳ com.android.tradefed.result.SnapshotInputStreamSource


A File-backed InputStreamSource. Creates a snapshot of original ERROR(/InputStream) contents to ensure that createInputStream() will return identically-behaving ERROR(/InputStream)s as required.

Summary

Public constructors

SnapshotInputStreamSource(String name, InputStream stream)

Constructor for a file-backed InputStreamSource

Public methods

void close()

Do any required cleanup on the source of the InputStream.

InputStream createInputStream()

Return a new clone of the ERROR(/InputStream), so that the caller can read the stream from the beginning.

long size()

Return the size in bytes of the source data.

Public constructors

SnapshotInputStreamSource

public SnapshotInputStreamSource (String name, 
                InputStream stream)

Constructor for a file-backed InputStreamSource

Parameters
name String

stream InputStream

Public methods

close

public void close ()

Do any required cleanup on the source of the InputStream. Calling this method essentially invalidates this InputStreamSource.

createInputStream

public InputStream createInputStream ()

Return a new clone of the ERROR(/InputStream), so that the caller can read the stream from the beginning. Each invocation of this method (until cancel() is called) will return an identically-behaving ERROR(/InputStream) -- the same contents will be returned.

Returns
InputStream An ERROR(/InputStream) that the caller can use to read the data source from the beginning. May return null if this InputStreamSource has been invalidated by a prior call to cancel(), or if a new InputStream cannot be created for some other reason.

size

public long size ()

Return the size in bytes of the source data.

Returns
long