struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Raible <matt_rai...@yahoo.com>
Subject File Upload - how to speed up?
Date Tue, 26 Feb 2002 04:46:40 GMT
I'm using the struts-upload sample application to create file upload capability
in my application.  

Using the sample code, a ~50 MB file takes about 13 seconds to upload locally. 
I expect to have files that are similar in size, and I wonder how long this
might take over a T1 connection.

Is there anyway to optimize the following code - or is this already optimized?

OutputStream bos = new FileOutputStream(filePath);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
    bos.write(buffer, 0, bytesRead);
}
bos.close();

Thanks,

Matt

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message