I would guess that it's quite unperfomant the way you do it.

You should at leat read and write bigger chunks (1K to 8k 
are common values.

There is another problem: Are you shure that flash is using 
a simple download and won't use things from http 1.1 like 
byte range requests (and won't do it in the next version).

To implement this, you would have to implement much more code.
(Have a look at the source of the DefaultServlet) 
Or force the server to use HTTP 1.0)

> -----Original Message-----
> From: Carlos Pereira [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2003 9:10 PM
> To: Tomcat Users List
> Subject: File writing performance
> 
> response.setContentType("application/x-shockwave-flash");
> DataInputStream dis = new DataInputStream(
>   getServletContext().getResourceAsStream(filename)
> );
> OutputStream out = response.getOutputStream();
> int b = -1;
> while((b = dis.read()) != -1) {
>   out.write(b);
> }
> out.close();
> </code>
> 
> My question: is this approach more expensive than simply 
> retrieving the file? If so, is it significative?
> 

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

Reply via email to