public class StreamingMarkupWriter
extends Writer
Writer used by streaming markup support to escape XML lazily while honoring output encoding limits.
| Modifiers | Name | Description |
|---|---|---|
protected CharsetEncoder |
encoder |
Encoder used to decide when numeric character references are required. |
protected String |
encoding |
Normalized target encoding name. |
protected boolean |
encodingKnown |
Whether the target encoding was explicitly supplied or discovered from the wrapped writer. |
protected boolean |
haveHighSurrogate |
Whether a high surrogate is buffered awaiting its matching low surrogate. |
protected StringBuilder |
surrogatePair |
Temporary buffer for surrogate pair handling. |
protected Writer |
writer |
Underlying destination writer. |
protected boolean |
writingAttribute |
Whether output is currently inside an attribute value. |
| Constructor and description |
|---|
StreamingMarkupWriter(Writer writer, String encoding)Creates a streaming writer using the supplied encoding name and single-quote attribute escaping. |
StreamingMarkupWriter(Writer writer, String encoding, boolean useDoubleQuotes)Creates a streaming writer. |
StreamingMarkupWriter(Writer writer)Creates a streaming writer that infers its encoding from the wrapped writer when possible. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
close(){@inheritDoc} |
|
public Writer |
escaped()Returns a writer view that applies XML escaping before delegating here. |
|
public void |
flush(){@inheritDoc} |
|
public String |
getEncoding()Returns the normalized target encoding used for numeric escape decisions. |
|
public boolean |
getEncodingKnown()Returns whether the encoding came from an explicit or discoverable source. |
|
public void |
setWritingAttribute(boolean writingAttribute)Switches escaping rules between element text and attribute value output. |
|
public Writer |
unescaped()Returns a writer view that bypasses the additional escaping layer. |
|
public void |
write(int c){@inheritDoc} |
|
public void |
write(char[] cbuf, int off, int len){@inheritDoc} |
Encoder used to decide when numeric character references are required.
Normalized target encoding name.
Whether the target encoding was explicitly supplied or discovered from the wrapped writer.
Whether a high surrogate is buffered awaiting its matching low surrogate.
Temporary buffer for surrogate pair handling.
Underlying destination writer.
Whether output is currently inside an attribute value.
Creates a streaming writer using the supplied encoding name and single-quote attribute escaping.
writer - destination writerencoding - target encoding, or null to infer itCreates a streaming writer.
writer - destination writerencoding - target encoding, or null to infer ituseDoubleQuotes - whether attribute escaping should target double quotes instead of single quotesCreates a streaming writer that infers its encoding from the wrapped writer when possible.
writer - destination writer{@inheritDoc}
Returns a writer view that applies XML escaping before delegating here.
{@inheritDoc}
Returns the normalized target encoding used for numeric escape decisions.
Returns whether the encoding came from an explicit or discoverable source.
true if the encoding is known preciselySwitches escaping rules between element text and attribute value output.
writingAttribute - true when writing an attribute valueReturns a writer view that bypasses the additional escaping layer.
{@inheritDoc}
{@inheritDoc}
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.