Sure that is possible with PipedI/OStreams - and I would rely on that or QueueI/OStream (that should need no extra thread) in the implementation. But that (relying on rather simple implementation based on java.io) is as well true for the existing IOUtils.copy methods.
Like with the other IOUtils.copy methods it would just be a shorthand for a rather simple implementation. But one that the user can rely on to work probably better than their own implementation. -----Ursprüngliche Nachricht----- Von: Rob Spoor <[email protected]> Gesendet: Samstag, 9. Oktober 2021 12:40 An: [email protected] Betreff: Re: IO-753 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, [email protected] 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: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
