Class HTMLStripCharFilter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public final class HTMLStripCharFilter
    extends BaseCharFilter
    A CharFilter that wraps another Reader and attempts to strip out HTML constructs.
    • Constructor Summary

      Constructors 
      Constructor Description
      HTMLStripCharFilter​(java.io.Reader source)
      Creates a new HTMLStripCharFilter over the provided Reader.
      HTMLStripCharFilter​(java.io.Reader source, java.util.Set<java.lang.String> escapedTags)
      Creates a new HTMLStripCharFilter over the provided Reader with the specified start and end tags.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the underlying input stream.
      int read()  
      int read​(char[] cbuf, int off, int len)  
      • Methods inherited from class java.io.Reader

        mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HTMLStripCharFilter

        public HTMLStripCharFilter​(java.io.Reader source)
        Creates a new HTMLStripCharFilter over the provided Reader.
        Parameters:
        source - Reader to strip html tags from.
      • HTMLStripCharFilter

        public HTMLStripCharFilter​(java.io.Reader source,
                                   java.util.Set<java.lang.String> escapedTags)
        Creates a new HTMLStripCharFilter over the provided Reader with the specified start and end tags.
        Parameters:
        source - Reader to strip html tags from.
        escapedTags - Tags in this set (both start and end tags) will not be filtered out.
    • Method Detail

      • read

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

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws java.io.IOException
        Specified by:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: CharFilter
        Closes the underlying input stream.

        NOTE: The default implementation closes the input Reader, so be sure to call super.close() when overriding this method.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class CharFilter
        Throws:
        java.io.IOException