InputStreamSource

public interface InputStreamSource

com.android.tradefed.result.InputStreamSource


This interface basically wraps an ERROR(/InputStream) to make it clonable.

It should be expected that a resource will be leaked unless cancel() is called, and that once cancel() is called on an instance, that that instance and any ERROR(/InputStream)s it has created will be invalid.

Summary

Public methods

default void cancel()

This method is deprecated. use close() instead.

abstract void close()

Do any required cleanup on the source of the InputStream.

abstract InputStream createInputStream()

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

abstract long size()

Return the size in bytes of the source data.

Public methods

cancel

public void cancel ()

This method is deprecated.
use close() instead.

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

close

public abstract void close ()

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

createInputStream

public abstract 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 abstract long size ()

Return the size in bytes of the source data.

Returns
long