Hi Folks,  

I'm using S2 Stream result type to allow users to download a CSV "file" that I 
dynamically write from records selected from a database.

First pass on this I'm using a StringWriter to write out the CSV data (using 
SuperCSV) that using the string to build a ByteArrayInputStream for the 
InputStream result.

My concern is that the results could get very large based on the the selection 
criteria the user supplies. So trying to do this all in-memory with a 
StringWriter->String->Byte[] is likely a bad idea.

I'm looking for advice on a better way of doing this?  
I thought I could write to a temp file, but how do I ensure the file is deleted 
when the download completes?
I also thought about using a PipedInputStream and hooking to a 
PipedOutputStream which I write to in another thread, but this seems like it 
could become overly complicated having to deal with the threads and database 
sessions and error conditions etc.

Do you know a better way?

Any advice or suggestions would be appreciated.
  
Thanks
Greg




      

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to