java - Piping output from an output stream to an input stream -
my problem piping input 1 socket another. currently, using code:
for(;;) { try { output2.write(input1.read()); } catch(exception err) { err.printstacktrace(); } }
even though technically works, there faster way this?
you can use bytestreams#copy(inputstream, outputstream) google guava:
try { bytestreams.copy(input1, output2); } catch (ioexception x) { x.printstacktrace(); }
Comments
Post a Comment