tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject RE: File writing performance
Date Wed, 22 Oct 2003 08:53:45 GMT
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:khepera@portugalmail.pt]
> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message