Two options:
Memory
If the "file" in question is small enough for it to be viable, you could read the data into a ByteArrayOutputStream, and then use its toByteArray method to construct a ByteArrayInputStream to read from.
Piping
To avoid storing more in memory than necessary, you could use PipedOutputStream and PipedInputStream.
PipedOutputStream:
A piped output stream can be connected to a piped input stream to create a communications pipe. The piped output stream is the sending end of the pipe. Typically, data is written to a PipedOutputStream object by one thread and data is read from the connected PipedInputStream by some other thread.
PipedInputStream:
A piped input stream should be connected to a piped output stream; the piped input stream then provides whatever data bytes are written to the piped output stream. Typically, data is read from a PipedInputStream object by one thread and data is written to the corresponding PipedOutputStream by some other thread.
You give the API the output stream, and read from the input stream.