Is there an easy (therefore quick) way to accomplish this? Basically just take some input stream, could be something like a socket.getInputStream(), and have the stream’s buffer autmoatically redirect to standard out?
Is there an easy (therefore quick) way to accomplish this? Basically just take some
Share
There are no easy ways to do it, because
InputStreamhas a pull-style interface, whenOutputStreamhas a push-style one. You need some kind of pumping loop to pull data fromInputStreamand push them intoOutputStream. Something like this (run it in a separate thread if necessary):It’s already implemented in Apache Commons IO as
IOUtils.copy()