org.eclipse.mylar.internal.tasks.ui.util
Class HTML2TextReader

java.lang.Object
  extended by java.io.Reader
      extended by org.eclipse.mylar.internal.tasks.ui.util.SingleCharReader
          extended by org.eclipse.mylar.internal.tasks.ui.util.SubstitutionTextReader
              extended by org.eclipse.mylar.internal.tasks.ui.util.HTML2TextReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class HTML2TextReader
extends SubstitutionTextReader

COPY OF: org.eclipse.jface.internal.text.html.HTML2TextReader


Field Summary
private static java.lang.String EMPTY_STRING
           
private  int fBold
           
private  int fCounter
           
private static java.util.Map fgEntityLookup
           
private static java.util.Set fgTags
           
private  boolean fIgnore
           
private  boolean fInParagraph
           
private  boolean fIsPreformattedText
           
private  int fStartOffset
           
private  org.eclipse.jface.text.TextPresentation fTextPresentation
           
 
Fields inherited from class org.eclipse.mylar.internal.tasks.ui.util.SubstitutionTextReader
fWasWhiteSpace, LINE_DELIM
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
HTML2TextReader(java.io.Reader reader, org.eclipse.jface.text.TextPresentation presentation)
          Transforms the HTML text from the reader to formatted text.
 
Method Summary
protected  java.lang.String computeSubstitution(int c)
          Computes the substitution for the given character and if necessary subsequent characters.
protected  java.lang.String entity2Text(java.lang.String symbol)
           
private  java.lang.String html2Text(java.lang.String html)
           
private  java.lang.String processEntity()
           
private  java.lang.String processHTMLTag()
           
private  java.lang.String processPreformattedText(int c)
           
 int read()
           
protected  void startBold()
           
protected  void startPreformattedText()
           
protected  void stopBold()
           
protected  void stopPreformattedText()
           
private  void unread(int ch)
           
 
Methods inherited from class org.eclipse.mylar.internal.tasks.ui.util.SubstitutionTextReader
close, getReader, isSkippingWhitespace, nextChar, ready, reset, setSkipWhitespace
 
Methods inherited from class org.eclipse.mylar.internal.tasks.ui.util.SingleCharReader
getString, read
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

private static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values

fgEntityLookup

private static final java.util.Map fgEntityLookup

fgTags

private static final java.util.Set fgTags

fCounter

private int fCounter

fTextPresentation

private org.eclipse.jface.text.TextPresentation fTextPresentation

fBold

private int fBold

fStartOffset

private int fStartOffset

fInParagraph

private boolean fInParagraph

fIsPreformattedText

private boolean fIsPreformattedText

fIgnore

private boolean fIgnore
Constructor Detail

HTML2TextReader

public HTML2TextReader(java.io.Reader reader,
                       org.eclipse.jface.text.TextPresentation presentation)
Transforms the HTML text from the reader to formatted text.

Parameters:
reader - the reader
presentation - If not null, formattings will be applied to the presentation.
Method Detail

read

public int read()
         throws java.io.IOException
Overrides:
read in class SubstitutionTextReader
Throws:
java.io.IOException
See Also:
Reader.read()

startBold

protected void startBold()

startPreformattedText

protected void startPreformattedText()

stopPreformattedText

protected void stopPreformattedText()

stopBold

protected void stopBold()

computeSubstitution

protected java.lang.String computeSubstitution(int c)
                                        throws java.io.IOException
Description copied from class: SubstitutionTextReader
Computes the substitution for the given character and if necessary subsequent characters. Implementation should use nextChar to read subsequent characters.

Specified by:
computeSubstitution in class SubstitutionTextReader
Parameters:
c - the character to be substituted
Returns:
the substitution for c
Throws:
java.io.IOException - in case computing the substitution fails

html2Text

private java.lang.String html2Text(java.lang.String html)

processHTMLTag

private java.lang.String processHTMLTag()
                                 throws java.io.IOException
Throws:
java.io.IOException

processPreformattedText

private java.lang.String processPreformattedText(int c)

unread

private void unread(int ch)
             throws java.io.IOException
Throws:
java.io.IOException

entity2Text

protected java.lang.String entity2Text(java.lang.String symbol)

processEntity

private java.lang.String processEntity()
                                throws java.io.IOException
Throws:
java.io.IOException