Re: Converting objects to InputStream
Saturday, April 28, 2001 01:57 PM
You can always write to a buffer using a ByteArrayOutputStream
and then read from that buffer using ByteArrayInputStream,
but I would go even further and use a PipedOutputStream along
with a PipedInputStream so that you don't have to
maintain a buffer - this is just like hooking your output directly
to the input. Read the API documentation for how to use these.
Isn't your design a little screwy? Usually the input stream would
be used to read from the database, and the output
stream to write to the database. It doesn't make
sense to me that you would have to provide an input stream
for data that is intended to be written to the database.