Interface InputStreamSource

  • @ExperimentalApi
    public interface InputStreamSource
    Provides an InputStream. This interface can be conveniently passed as an argument to other methods. Passing the InputStream directly is confusing because it inhibits the usage of try-with-resource statement and is sometime not clear who will be responsible for closing the stream.
    • Method Detail

      • getInputStream

        InputStream getInputStream()
                            throws IOException
        Obtains an InputStream. It is expected that each call creates a fresh stream so it is a responsibility of the caller to close the returned stream after using it either explicitly or by using try-with-resource statement.