private static String loadStreamContent(InputStream stream) throws IOException {
  StringBuilder content=new StringBuilder();
  BufferedReader reader=new BufferedReader(new InputStreamReader(stream));
  try {
    char[] buff=new char[1024];
    int i=0;
    while ((i=reader.read(buff)) != -1) {
      content.append(buff,0,i);
    }
  }
  finally {
    reader.close();
  }
  return content.toString();
}

private static String loadStreamContent ( InputStream stream ) throws IOException { StringBuilder content = new StringBuilder ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; try { char [ ] buff = new char [ 1024 ] ; int i = 0 ; while ( ( i = reader . read ( buff ) ) != - 1 ) { content . append ( buff , 0 , i ) ; } } finally { reader . close ( ) ; } return content . toString ( ) ; }
loads a file into string
