Class DefaultCallback

java.lang.Object
it.unimi.dsi.parser.callback.DefaultCallback
All Implemented Interfaces:
Callback
Direct Known Subclasses:
LinkExtractor, TextExtractor

@Deprecated public class DefaultCallback extends Object implements Callback
Deprecated.
This class is obsolete and kept around for backward compatibility only.
A default, do-nothing-at-all callback.

Callbacks can inherit from this class and forget about methods they are not interested in.

This class has a protected constructor. If you need an instance of this class, use getInstance().

  • Field Summary

    Fields inherited from interface it.unimi.dsi.parser.callback.Callback

    EMPTY_CALLBACK_ARRAY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    cdata(Element elementUnused, char[] textUnused, int offsetUnused, int lengthUnused)
    Deprecated.
    Receive notification of the content of a CDATA section.
    boolean
    characters(char[] textUnused, int offsetUnused, int lengthUnused, boolean flowBrokenUnused)
    Deprecated.
    Receive notification of character data inside an element.
    void
    configure(BulletParser parserUnused)
    Deprecated.
    Configure the parser for usage with this callback.
    void
    Deprecated.
    Receive notification of the end of the document.
    boolean
    endElement(Element elementUnused)
    Deprecated.
    Receive notification of the end of an element.
    Deprecated.
    Returns the singleton instance of the default callback.
    void
    Deprecated.
    Receive notification of the beginning of the document.
    boolean
    startElement(Element elementUnused, Map<Attribute,MutableString> attrMapUnused)
    Deprecated.
    Receive notification of the start of an element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultCallback

      protected DefaultCallback()
      Deprecated.
  • Method Details

    • getInstance

      public static DefaultCallback getInstance()
      Deprecated.
      Returns the singleton instance of the default callback.
      Returns:
      the singleton instance of the default callback.
    • configure

      public void configure(BulletParser parserUnused)
      Deprecated.
      Description copied from interface: Callback
      Configure the parser for usage with this callback.

      When a callback is registered with a parser, it needs to set up the parser so that all data required by the callback is actually parsed. The configuration must be a monotone process—you can only set properties and add attribute types to be parsed.

      Specified by:
      configure in interface Callback
    • startDocument

      public void startDocument()
      Deprecated.
      Description copied from interface: Callback
      Receive notification of the beginning of the document.

      The callback must use this method to reset its internal state so that it can be resued. It must be safe to invoke this method several times.

      Specified by:
      startDocument in interface Callback
    • startElement

      public boolean startElement(Element elementUnused, Map<Attribute,MutableString> attrMapUnused)
      Deprecated.
      Description copied from interface: Callback
      Receive notification of the start of an element.

      For simple elements, this is the only notification that the callback will ever receive.

      Specified by:
      startElement in interface Callback
      Parameters:
      elementUnused - the element whose opening tag was found.
      attrMapUnused - a map from Attributes to MutableStrings.
      Returns:
      true to keep the parser parsing, false to stop it.
    • endElement

      public boolean endElement(Element elementUnused)
      Deprecated.
      Description copied from interface: Callback
      Receive notification of the end of an element. Warning: unless specific decorators are used, in general a callback will just receive notifications for elements whose closing tag appears explicitly in the document.

      This method will never be called for element without closing tags, even if such a tag is found.

      Specified by:
      endElement in interface Callback
      Parameters:
      elementUnused - the element whose closing tag was found.
      Returns:
      true to keep the parser parsing, false to stop it.
    • characters

      public boolean characters(char[] textUnused, int offsetUnused, int lengthUnused, boolean flowBrokenUnused)
      Deprecated.
      Description copied from interface: Callback
      Receive notification of character data inside an element.

      You must not write into text, as it could be passed around to many callbacks.

      flowBroken will be true iff the flow was broken before text. This feature makes it possible to extract quickly the text in a document without looking at the elements.

      Specified by:
      characters in interface Callback
      Parameters:
      textUnused - an array containing the character data.
      offsetUnused - the start position in the array.
      lengthUnused - the number of characters to read from the array.
      flowBrokenUnused - whether the flow is broken at the start of text.
      Returns:
      true to keep the parser parsing, false to stop it.
    • cdata

      public boolean cdata(Element elementUnused, char[] textUnused, int offsetUnused, int lengthUnused)
      Deprecated.
      Description copied from interface: Callback
      Receive notification of the content of a CDATA section.

      CDATA sections in an HTML document are the result of meeting a STYLE or SCRIPT element. In that case, the element will be passed as first argument.

      You must not write into text, as it could be passed around to many callbacks.

      Specified by:
      cdata in interface Callback
      Parameters:
      elementUnused - the element enclosing the CDATA section, or null if the CDATA section was created with explicit markup.
      textUnused - an array containing the character data.
      offsetUnused - the start position in the array.
      lengthUnused - the number of characters to read from the array.
      Returns:
      true to keep the parser parsing, false to stop it.
    • endDocument

      public void endDocument()
      Deprecated.
      Description copied from interface: Callback
      Receive notification of the end of the document.
      Specified by:
      endDocument in interface Callback