
org.owasp.html.AutoCloseableHtmlStreamRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of owasp-java-html-sanitizer Show documentation
Show all versions of owasp-java-html-sanitizer Show documentation
Takes third-party HTML and produces HTML that is safe to embed in
your web application.
Fast and easy to configure.
package org.owasp.html;
import java.io.IOException;
import javax.annotation.WillCloseWhenClosed;
final class AutoCloseableHtmlStreamRenderer extends HtmlStreamRenderer
implements AutoCloseable {
private final AutoCloseable closeable;
static boolean isAutoCloseable(Object o) {
return o instanceof AutoCloseable;
}
static AutoCloseableHtmlStreamRenderer createAutoCloseableHtmlStreamRenderer(
@WillCloseWhenClosed
Appendable output, Handler super IOException> errorHandler,
Handler super String> badHtmlHandler) {
return new AutoCloseableHtmlStreamRenderer(
output, errorHandler, badHtmlHandler);
}
private AutoCloseableHtmlStreamRenderer(
@WillCloseWhenClosed
Appendable output, Handler super IOException> errorHandler,
Handler super String> badHtmlHandler) {
super(output, errorHandler, badHtmlHandler);
this.closeable = (AutoCloseable) output;
}
public void close() throws Exception {
if (isDocumentOpen()) { closeDocument(); }
closeable.close();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy