com.openexchange.mail.text
Class HTML2Text

java.lang.Object
  extended by com.openexchange.mail.text.HTML2Text

public final class HTML2Text
extends java.lang.Object

HTML2Text - This class converts HTML content to valid text/plain based on HTMLEditorKit.

Author:
Stefan Preuss, Thorben Betten

Constructor Summary
HTML2Text(boolean appendHref)
          Initializes a new HTML2Text with default capacity of 8192
HTML2Text(int capacity, boolean appendHref)
          Initializes a new HTML2Text
 
Method Summary
 java.lang.String html2text(java.lang.String html)
          Converts specified HTML content to plain text
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTML2Text

public HTML2Text(boolean appendHref)
Initializes a new HTML2Text with default capacity of 8192

Parameters:
appendHref - true to append href and src attributes' content in brackets; otherwise false.
Example: <a href=\"www.somewhere.com\">Link<a> would be Link [www.somewhere.com]

HTML2Text

public HTML2Text(int capacity,
                 boolean appendHref)
Initializes a new HTML2Text

Parameters:
capacity - The initial capacity.
appendHref - true to append href and src attributes' content in brackets; otherwise false.
Example: <a href=\"www.somewhere.com\">Link<a> would be Link [www.somewhere.com]
Method Detail

html2text

public java.lang.String html2text(java.lang.String html)
                           throws java.io.IOException
Converts specified HTML content to plain text

Parameters:
html - The HTML content to convert
Returns:
The corresponding text extracted from HTML content
Throws:
java.io.IOException - If an I/O error occurs