Class AbstractFilter

java.lang.Object
com.day.cq.dam.commons.handler.AbstractFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
XPacketFilter

public abstract class AbstractFilter extends Object implements Filter
Continuously filter bytes and produce an output that can be read back. Optionally pass processed bytes to a next filter.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    filter(byte[] buf, int off, int len)
    Filter a couple of bytes.
    boolean
    Return a flag indicating whether the contents processed by this filter represents a valid entity.
    final void
    Reset the filter.
    void
    setAutoReset(boolean autoReset)
    Set the flag indicating whether the filter automatically resets its internal state when the end marker has been read.
    void
    Set a filter state listener.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setFilterStateListener

      public void setFilterStateListener(FilterStateListener listener)
      Set a filter state listener.
      Parameters:
      listener - listener
    • filter

      public final void filter(byte[] buf, int off, int len) throws IOException
      Filter a couple of bytes.
      Specified by:
      filter in interface Filter
      Parameters:
      buf - buffer
      off - offset inside buffer
      len - number of bytes
      Throws:
      IOException
    • reset

      public final void reset()
      Reset the filter.
      Specified by:
      reset in interface Filter
    • setAutoReset

      public void setAutoReset(boolean autoReset)
      Set the flag indicating whether the filter automatically resets its internal state when the end marker has been read.
      Specified by:
      setAutoReset in interface Filter
      Parameters:
      autoReset - autoReset
    • isValid

      public boolean isValid()
      Return a flag indicating whether the contents processed by this filter represents a valid entity. This implementation returns true.
      Specified by:
      isValid in interface Filter
      Returns:
      true if the contents is valid; false otherwise.