commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@mulework.com>
Subject RE: [commons-io] CopyUtils
Date Wed, 14 Jul 2004 01:17:08 GMT
Leo, thanks for replying.

The docs for CopyUtils.copy(InputStream in, OutputStream out) explicitely state:

"The copy methods use an internal buffer when copying. It is therefore advisable 
 not to deliberately wrap the stream arguments to the copy methods in Buffered* streams."

I took a peek at CVS and it's a trivial modification to achieve the functionality I need.

I should have done this before wasting the bandwidth.

robert


> -----Original Message-----
> From: Leo Sutic [mailto:leo.sutic@gmail.com]
> Sent: Tuesday, July 13, 2004 6:35 PM
> To: Jakarta Commons Users List
> Subject: Re: [commons-io] CopyUtils
> 
> 
> 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
> 

---------------------------------------------------------------------
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