Interface InputStreamOpener


public interface InputStreamOpener
Defines an interface for opening a new input stream for reading. This interface must open a new stream for each request.

Thread safety

Implementations of this interface must be safe to be accessed by multiple threads concurrently.

Synchronization transparency

Implementations of this interface are not required to be synchronization transparent.
  • Method Summary

    Modifier and Type
    Method
    Description
    Opens a new stream to the source defined by this InputStreamOpener instance.
  • Method Details

    • openStream

      InputStream openStream(CancellationToken cancelToken) throws IOException
      Opens a new stream to the source defined by this InputStreamOpener instance. This method opens a new stream each time it is called an these opened channels must be closed separately.
      Parameters:
      cancelToken - the CancellationToken through which callers may notify this method that the channel is no longer need to be opened. Implementations are free to ignore this request but if they don't, they must throw an OperationCanceledException in response to the cancellation request. This argument cannot be null.
      Returns:
      the new stream to the source defined by this InputStreamOpener instance. The returned instance must be closed in order to prevent resource leakage. This method never returns null.
      Throws:
      OperationCanceledException - thrown if cancellation was detected by this method
      IOException - thrown if the stream could not be opened for some reasons