code: public static String extractText(InputStream in, String encoding)
      throws ParserException, UnsupportedEncodingException {
  
          Parser parser = new Parser();
          Lexer lexer = new Lexer();
          Page page = new Page(in, encoding);
          lexer.setPage(page);
          parser.setLexer(lexer);
  
          StringBean stringBean = new StringBean();
          parser.visitAllNodesWith(stringBean);
  
          String result = stringBean.getStrings();
          return result == null ? "" : result;
      }
docs: Extract the text from a HTML page.<p>
  
  @param in the html content input stream
  @param encoding the encoding of the content
  
  @return the extracted text from the page
  @throws ParserException if the parsing of the HTML failed
  @throws UnsupportedEncodingException if the given encoding is not supported