You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by se...@e-movimento.com on 2021/10/09 08:44:33 UTC

IO-753

Hi!



I'd like to contribute to https://issues.apache.org/jira/browse/IO-753
"Provide a IOUtils.copy(OutputStream, InputStream)"

AFAIK this not possible without an extra thread which might be seen as too
"heavy" for commons-io.

 

So my question is: Is there any chance that such a PR will be accepted?

If not are there any other frameworks such a request would fit in?

If so, are there any thread pools already used in commons-io?

 

Thanks,

Sebastian


Re: IO-753

Posted by Rob Spoor <ap...@icemanx.nl>.
Isn't this already possible with PipedOutputStream and PipedOutputStream?

     PipedInputStream inputStream = new PipedInputStream(size);
     PipedOutputStream outputStream = new PipedOutputStream(inputStream);

Any write to outputStream is now visible in inputStream. Note that the 
writing and reading need to be done in separate threads. The same goes 
for the use case in the ticket though.

If only one thread can be used, you need to write everything first. An 
UnsynchronizedByteArrayOutputStream (from Commons IO) should be good 
enough, as it provides a toInputStream() method. With 
java.io.ByteArrayOutputStream, toByteArray() is needed, which copies the 
data - unnecessarily in this case.


On 09/10/2021 10:44, sebastian.dietrich@e-movimento.com wrote:
> Hi!
> 
> 
> 
> I'd like to contribute to https://issues.apache.org/jira/browse/IO-753
> "Provide a IOUtils.copy(OutputStream, InputStream)"
> 
> AFAIK this not possible without an extra thread which might be seen as too
> "heavy" for commons-io.
> 
>   
> 
> So my question is: Is there any chance that such a PR will be accepted?
> 
> If not are there any other frameworks such a request would fit in?
> 
> If so, are there any thread pools already used in commons-io?
> 
>   
> 
> Thanks,
> 
> Sebastian

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