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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -