Converting objects to InputStream
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nishant_Usapkar
Posted On:   Saturday, April 28, 2001 02:28 AM

I have to store a hashtable as BLOB in Oracle8i database, for which I need to convert the hashTable object to any Inputstream.

I am currently writing a file of the object using FileOutputStream and later reading the File into InputStream.

I need to know is there anyother way I can read the object into inputStream without making a physical file

Re: Converting objects to InputStream

Posted By:   Tim_Rohaly  
Posted On:   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.
About | Sitemap | Contact