public abstract class AbstractStreamingHtmlEscaper extends LoggingAdvisingAppendable
LoggingAdvisingAppendable that can detect when the appendable is in an html
context or not.
This tracks the activeAppendable, or the appendable append calls should be
sent to, based on the content kind. The active appendable starts out as the appendable that does
the escaping (the escapingAppendable constructor param). Subclasses can overwrite the
activeAppendable field in the #notifyContentKind(ContentKind) method based on the
content kind.
LoggingAdvisingAppendable.BufferingAppendable| Modifier and Type | Field and Description |
|---|---|
protected Appendable |
activeAppendable |
protected LoggingAdvisingAppendable |
delegate |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStreamingHtmlEscaper(LoggingAdvisingAppendable delegate,
Appendable escapingAppendable) |
| Modifier and Type | Method and Description |
|---|---|
LoggingAdvisingAppendable |
append(char c) |
LoggingAdvisingAppendable |
append(CharSequence csq) |
LoggingAdvisingAppendable |
append(CharSequence csq,
int start,
int end) |
protected boolean |
isInHtml() |
protected void |
notifyContentDirectionality(Dir contentDir)
Called when the directionality is initially set.
|
protected abstract void |
notifyContentKind(SanitizedContent.ContentKind kind)
Override this to set the appendable for the
append methods to delegate to, based on the
content kind. |
boolean |
softLimitReached()
Indicates that an internal limit has been reached or exceeded and that write operations should
be suspended soon.
|
appendLoggingFunctionInvocation, buffering, delegating, enterLoggableElement, escapePlaceholder, exitLoggableElement, getSanitizedContentDirectionality, getSantizedContentKind, setSanitizedContentDirectionality, setSanitizedContentKind, stringCoercingprotected final LoggingAdvisingAppendable delegate
protected Appendable activeAppendable
protected AbstractStreamingHtmlEscaper(LoggingAdvisingAppendable delegate, Appendable escapingAppendable)
public final LoggingAdvisingAppendable append(CharSequence csq) throws IOException
append in interface AdvisingAppendableappend in interface Appendableappend in class LoggingAdvisingAppendableIOExceptionpublic final LoggingAdvisingAppendable append(CharSequence csq, int start, int end) throws IOException
append in interface AdvisingAppendableappend in interface Appendableappend in class LoggingAdvisingAppendableIOExceptionpublic final LoggingAdvisingAppendable append(char c) throws IOException
append in interface AdvisingAppendableappend in interface Appendableappend in class LoggingAdvisingAppendableIOExceptionpublic final boolean softLimitReached()
AdvisingAppendableprotected abstract void notifyContentKind(SanitizedContent.ContentKind kind) throws IOException
append methods to delegate to, based on the
content kind.notifyContentKind in class LoggingAdvisingAppendableIOException#setSanitizedContentKind(ContentKind)protected void notifyContentDirectionality(@Nullable Dir contentDir) throws IOException
LoggingAdvisingAppendablenotifyContentDirectionality in class LoggingAdvisingAppendableIOExceptionLoggingAdvisingAppendable.setSanitizedContentDirectionality(Dir)protected final boolean isInHtml()