protected void copyStreams ( InputStream is , OutputStream os ) throws IOException { byte [ ] buffer = new byte [ 1024 ] ; try { int read ; while ( ( read = is . read ( buffer ) ) != - 1 ) { os . write ( buffer , 0 , read ) ; buffer = new byte [ 1024 ] ; } } finally { if ( null != os ) os . close ( ) ; if ( null != is ) is . close ( ) ; } }
Reads from the input stream and copies to the output stream