protected void pipe(InputStream in,OutputStream out) throws IOException {
  BufferedOutputStream bufferedOut=new BufferedOutputStream(out);
  int n;
  byte[] bytes=new byte[1024 * 4];
  while ((n=in.read(bytes)) != -1) {
    bufferedOut.write(bytes,0,n);
  }
  bufferedOut.flush();
  bufferedOut.close();
  in.close();
}

protected void pipe ( InputStream in , OutputStream out ) throws IOException { BufferedOutputStream bufferedOut = new BufferedOutputStream ( out ) ; int n ; byte [ ] bytes = new byte [ 1024 * 4 ] ; while ( ( n = in . read ( bytes ) ) != - 1 ) { bufferedOut . write ( bytes , 0 , n ) ; } bufferedOut . flush ( ) ; bufferedOut . close ( ) ; in . close ( ) ; }
reads all the data from the specified input stream and writes it to the specified output stream . both streams are also closed . todo : make these commands as part of a generic helper class in cargo . duplicate function in the tomcat remote deployer
