Reputation: 91740
I'm using an API (Jasper Reports) to generate PDFs and I'd like to do most of it in memory. I'm already able to get the generated file as an OutputStream
, now I'm just looking for an implementor to use to keep things in memory which implements InputStream
as well.
What class can I use which functions as both an OutputStream
and an InputStream
on in-memory data?
Upvotes: 1
Views: 9130
Reputation: 1819
This Passage would be suitable more here, focusing on the dual implementation on both of Input and Output.
http://blog.ostermiller.org/convert-a-java-writer-to-a-reader/
As metioned in the article, the PipedReader
and PipedWriter
would be a awesome solution, and the Circular Buffer
provided from Ostermiller.util as well if you are allowed to import another dependency.
Upvotes: 0
Reputation: 340883
ByteArrayInputStream
and ByteArrayOutputStream
to the rescue.
Upvotes: 10