public static void writeStreamToStream ( InputStream input , OutputStream output ) throws IOException { byte [ ] buffer = new byte [ 4096 ] ; while ( true ) { int len = input . read ( buffer ) ; if ( len == - 1 ) { break ; } output . write ( buffer , 0 , len ) ; } }
Send all bytes from the input stream to the output stream .