org.apache.lucene.analysis.charfilter

## Class HTMLStripCharFilter

- java.lang.Object
- - java.io.Reader
  - - org.apache.lucene.analysis.CharFilter
    - - org.apache.lucene.analysis.charfilter.BaseCharFilter
      - - org.apache.lucene.analysis.charfilter.HTMLStripCharFilter

- All Implemented Interfaces:
    Closeable, AutoCloseable, Readable

      public final class HTMLStripCharFilter
      extends BaseCharFilter

  A CharFilter that wraps another Reader and attempts to strip out HTML constructs.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.analysis.CharFilter

      `input`

    - ### Fields inherited from class java.io.Reader

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTMLStripCharFilter(Reader in)` Creates a new scanner
    `HTMLStripCharFilter(Reader in, Set<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 and Description
    --- | ---
    `void` | `close()`
    `int` | `read()`
    `int` | `read(char[] cbuf, int off, int len)`

    - ### Methods inherited from class org.apache.lucene.analysis.charfilter.BaseCharFilter

      `addOffCorrectMap, correct, getLastCumulativeDiff`

    - ### Methods inherited from class org.apache.lucene.analysis.CharFilter

      `correctOffset`

    - ### Methods inherited from class java.io.Reader

      `mark, markSupported, read, read, ready, reset, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HTMLStripCharFilter

          public HTMLStripCharFilter(Reader in,
                                     Set<String> escapedTags)

      Creates a new HTMLStripCharFilter over the provided Reader with the specified start and end tags.
      Parameters:
        `in` - Reader to strip html tags from.
        `escapedTags` - Tags in this set (both start and end tags) will not be filtered out.

    - #### HTMLStripCharFilter

          public HTMLStripCharFilter(Reader in)

      Creates a new scanner
      Parameters:
        `in` - the java.io.Reader to read input from.

  - ### Method Detail

    - #### read

          public int read()
                   throws IOException

      Overrides:
        `read` in class `Reader`
      Throws:
        `IOException`

    - #### read

          public int read(char[] cbuf,
                          int off,
                          int len)
                   throws IOException

      Specified by:
        `read` in class `Reader`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `CharFilter`
      Throws:
        `IOException`

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.