Hi Pawel, > But if this data has to be manipulated (concatenated, changed, etc.) > the temporary file is needed if You don't want to put all data into > memory.
FYI in my case, I need to manipulate with data from DB and files to create a download file. Thanks. --- Pawe娼ネ Wielgus <poulw...@gmail.com> wrote: > Hi, > it all depends. > Where You take data from - database? > How You manipulate the data if any - are You combining some fields or > something? > > It's possible to take some data from DB and read it from reasult set > as a stream and just forward it to the user browser. > > But if this data has to be manipulated (concatenated, changed, etc.) > the temporary file is needed if You don't want to put all data into > memory. > Of course You can create Your own stream that will put only small > chunks of data into memory, > but that's not trivial to do. > > Hope that helps, > Pawe芝� Wielgus. > > > 2010/9/16 <lunch...@yahoo.co.jp>: > > Hi Wielgus, > > > > Thank you for the example. > > > > That example you provided can work fine. > > But I'm afraid I can not apply this way. > > > > When using ByteArrayInputStream, I need to hold all contents of a > download > > file.But I must handle a huge file that can not be placed in > memory. > > > > I'm sorry that I did not tell exactly. > > > > Thanks anyway. > > > > --- Pawe幞湿裙� Wielgus <poulw...@gmail.com> wrote: > > > >> Hi all, > >> try this for example: > >> > >> public InputStream getInputStream() throws ParseException, > >> UnsupportedEncodingException { > >> 篠 篠 篠 篠 StringBuffer sb = new StringBuffer("blablabla") > >> 篠 篠 篠 篠 .... > >> 篠 篠 篠 篠 return new > >> ByteArrayInputStream(sb.toString().getBytes("windows-1250")); > >> } > >> > >> Best greetings, > >> Pawe裘悉裘自賾� Wielgus. > >> > >> > >> 2010/9/16 Tommy Pham <tommy...@gmail.com>: > >> > > >> >> -----Original Message----- > >> >> From: lunch...@yahoo.co.jp [mailto:lunch...@yahoo.co.jp] > >> >> Sent: Wednesday, September 15, 2010 9:23 PM > >> >> To: Struts Users Mailing List > >> >> Subject: Re: How to download a file without creating it on a > >> server > >> >> > >> >> Hi Dave and Allen, > >> >> > >> >> Thank you for quick reply. > >> >> > >> >> Frankly speaking, I'm not familiarity with using stream and > could > >> not come > >> >> up with some ideas. > >> >> > >> >> When I coded with java.io.PipedInputStream/PipedOutputStream > >> >> like follwoing, I could download an empty file with > >> IllegalStateException. > >> >> > >> >> If anyone give an example how to code,I will really appreciate. > >> >> > >> >> Thanks. > >> >> > >> >> > >> > > >> > IIRC, Struts uses the Apache Commons FileUpload > >> > http://commons.apache.org/fileupload/. > >> > You could read more about the Streaming API with examples in the > >> provided > >> > link. > >> > > >> > Regards, > >> > Tommy > >> > > >> > > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> > For additional commands, e-mail: user-h...@struts.apache.org > >> > > >> > > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> For additional commands, e-mail: user-h...@struts.apache.org > >> > >> > > > > > > -------------------------------------- > > Get the new Internet Explorer 8 optimized for Yahoo! JAPAN > > http://pr.mail.yahoo.co.jp/ie8/ > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -------------------------------------- Get the new Internet Explorer 8 optimized for Yahoo! JAPAN http://pr.mail.yahoo.co.jp/ie8/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org