commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Sutic <leo.su...@gmail.com>
Subject Re: [commons-io] CopyUtils
Date Tue, 13 Jul 2004 22:35:16 GMT
Hi Robert,

if your OutputStream is buffered, it will automatically flush the
buffer when it is full. Simply set the buffer to some reasonable size
for network use. The documentation refers to explicitly flushing the
output stream when the input stream reaches EOF.

For example, with a 40k buffer (pretty big), you'll need 26000 clients
before you have filled up 1GB of memory. Since you'll also be using up
one thread per client, your server will probably crash and burn and
die long before that.

/LS

On Tue, 13 Jul 2004 17:51:53 -0400, Robert Taylor <rtaylor@mulework.com> wrote:
> Greetings, I would like to use CopyUtils.copy(InputStream is, OutpuStream os) to manually
> server (read from input stream and write to output stream) up large binary files to web
clients (browsers).
> 
> After reading the documentation which indicates it does not flush the buffer in the method,
> I'm concerned that this would result in OutOfMemoryErrors under large loads.
> 
> I was under the assumption that it would be prudent to flush the buffer after a certain
number
> of reads to reduce the amount of resident memory used.
> 
> Is there a another utility to perform such a common task?
> 
> robert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message