tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wade Chandler" <>
Subject RE: File writing performance
Date Tue, 21 Oct 2003 19:21:00 GMT
The main problem with performance comes from your source code.  You are
reading 1 byte at a time then writing 1 byte at a time.  Use a buffered
input stream, and also use a buffered output stream.  Then read and
write a good number of bytes.  Maybe use a static section so you can
change the number of bytes for the buffers with a  properties file.


-----Original Message-----
From: Carlos Pereira [] 
Sent: Tuesday, October 21, 2003 3:10 PM
To: Tomcat Users List
Subject: File writing performance

I want to make a servlet which catches all accesses to *.swf files (with
a mapping) and only retrieves them if the permissions for the user allow
it. That can be done simply with:

// check user permissions and redirect to error page if needed // else:
DataInputStream dis = new DataInputStream(
OutputStream out = response.getOutputStream();
int b = -1;
while((b = != -1) {

My question: is this approach more expensive than simply retrieving the
file? If so, is it significative?

Best regards,
Carlos Pereira

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message