protected String streamToString(InputStream in,String charset) throws IOException {
  InputStreamReader reader=new InputStreamReader(in,charset);
  StringBuilder buffer=new StringBuilder();
  char[] chars=new char[1024];
  int n;
  while ((n=reader.read(chars,0,chars.length)) != -1) {
    buffer.append(chars,0,n);
  }
  return buffer.toString();
}

protected String streamToString ( InputStream in , String charset ) throws IOException { InputStreamReader reader = new InputStreamReader ( in , charset ) ; StringBuilder buffer = new StringBuilder ( ) ; char [ ] chars = new char [ 1024 ] ; int n ; while ( ( n = reader . read ( chars , 0 , chars . length ) ) != - 1 ) { buffer . append ( chars , 0 , n ) ; } return buffer . toString ( ) ; }
gets the data from the specified input stream as a string using the specified charset . todo : make these commands as part of a generic helper class in cargo . duplicate function in the tomcat remote deployer
