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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -