(I'm cross-posting this from the J2EE General forum. Not sure of the best place to post this question.)
We have a requirement for our users to be able to upload multiple xml files to our server for processing into our database. For security reasons, our network team does not want any files written to the servers (or any place accessible by the servers). Therefore, we are trying to work with the zipped files strictly within memory, without writing a physical file.
The problem is this:
The zip files exists in memory. The xml files have been unzipped into memory. But, after being unzipped, they exist in an output stream which can't be read (output streams are only for writing, right?). Therefore, to continue working with the xml (performing schema validations and loading into tables) they need to be in an input stream. We have not been able to find a way to convert an output stream into a new input stream.
Can anyone suggest a way to resolve this? Can we perform schema validations and load to tables from the output stream? I don't believe so. It is my understanding that you can only write from an output stream, and not read from it.
-
Copy FileOutputStream to New FileInputStream (2 messages)
- Posted by: Mark Renn
- Posted on: March 04 2005 17:36 EST
Threaded Messages (2)
- Jakarta Commons IO - IOUtils by Sualeh Fatehi on March 07 2005 08:12 EST
- Copy FileOutputStream to New FileInputStream by Matan Amir on March 12 2005 13:02 EST
-
Jakarta Commons IO - IOUtils[ Go to top ]
- Posted by: Sualeh Fatehi
- Posted on: March 07 2005 08:12 EST
- in response to Mark Renn
Jakarta Commons IO - IOUtils should have something that you can use:
http://jakarta.apache.org/commons/io/apidocs/org/apache/commons/io/IOUtils.html -
Copy FileOutputStream to New FileInputStream[ Go to top ]
- Posted by: Matan Amir
- Posted on: March 12 2005 13:02 EST
- in response to Mark Renn
You could simply use the ByteArrayOutputStream or StringWriter to receive the data.
Then receive the byte array / string from the result and use that as the data for an input stream (ByteArrayInputStream / StringReader / StringBufferInputStream / etc.)
Hope that helps,
Matan