To use a custom data source to send data through an input stream, construct a and PipedOutputStream to allow writing data from the output stream to the input. Make sure to do the work on a separate thread so the file can be returned immediately.