All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.owasp.html.HtmlStreamEventReceiverWrapper Maven / Gradle / Ivy

There is a newer version: 20240325.1
Show newest version
package org.owasp.html;

import java.io.Closeable;
import java.io.IOException;
import java.util.List;

/**
 * An event receiver that delegates to an underlying receiver and which may
 * be overridden to do additional work.
 */
public abstract class HtmlStreamEventReceiverWrapper
implements HtmlStreamEventReceiver,
// Not AutoCloseable for JDK 6 compatibility but will close AutoCloseable
// underlying streams when closed.
    Closeable {

  protected final HtmlStreamEventReceiver underlying;

  /**
   * @param underlying delegated to.
   */
  public HtmlStreamEventReceiverWrapper(HtmlStreamEventReceiver underlying) {
    this.underlying = underlying;
  }

  public void openDocument() {
    this.underlying.openDocument();
  }

  public void closeDocument() {
    this.underlying.closeDocument();
  }

  public void openTag(String elementName, List attrs) {
    this.underlying.openTag(elementName, attrs);
  }

  public void closeTag(String elementName) {
    this.underlying.closeTag(elementName);
  }

  public void text(String text) {
    this.underlying.text(text);
  }

  public void close() throws IOException {
    AutoCloseableHtmlStreamRenderer.closeIfAnyCloseable(underlying);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy