public abstract class AbstractWriter extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CDATA_BEG
A CDATA beg markup sequence
|
static String |
CDATA_END
A CDATA end markup sequence
|
static String |
COMMENT_BEG
A comment beg sequence
|
static String |
COMMENT_END
A comment end sequence
|
protected XmlConfig |
config
XML configuration
|
static MsgFormatter |
FORMATTER
Common formatter
|
static char |
FORWARD_SLASH
A forward slash character
|
static String |
HTML_DOCTYPE
Default DOCTYPE of HTML-5
|
protected boolean |
indentationEnabled
An indentation request
|
static char |
NBSP
Non-breaking space character
|
protected Appendable |
out
Output
|
static char |
SPACE
A special XML character
|
static char |
XML_2QUOT
A special XML character
|
static char |
XML_AMPERSAND
A special XML character
|
static char |
XML_APOSTROPHE
A special XML character
|
static char |
XML_GT
A special XML character
|
static String |
XML_HEADER
Default XML declaration
|
static char |
XML_LT
A special XML character
|
Constructor and Description |
---|
AbstractWriter(Appendable out,
XmlConfig config)
A writer constructor
|
Modifier and Type | Method and Description |
---|---|
static Appendable |
createWriter(Object httpServletResponse,
Charset charset,
boolean noCache)
Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse
|
Appendable |
getWriter()
For internal usage only
|
Appendable |
getWriterEscaped()
Get Writer to escape HTML characters.
|
String |
toString() |
void |
write(CharSequence text,
boolean attribute)
Write escaped value to the output
|
void |
writeNewLine(int level)
Write a new line with an offset by the current level
|
void |
writeRawValue(CharSequence rawValue,
ApiElement element)
Write the content of an envelope
|
void |
writeValue(Object value,
ApiElement element,
String attributeName)
Write escaped value to the output
|
public static final String XML_HEADER
public static final String HTML_DOCTYPE
public static final char XML_GT
public static final char XML_LT
public static final char XML_AMPERSAND
public static final char XML_APOSTROPHE
public static final char XML_2QUOT
public static final char SPACE
public static final char NBSP
public static final char FORWARD_SLASH
public static final String CDATA_BEG
public static final String CDATA_END
public static final String COMMENT_BEG
public static final String COMMENT_END
public static final MsgFormatter FORMATTER
@Nonnull protected final Appendable out
protected final boolean indentationEnabled
public AbstractWriter(@Nonnull Appendable out, @Nonnull XmlConfig config)
out
- A writerconfig
- XML configurationpublic final void write(@Nonnull CharSequence text, boolean attribute) throws IOException
text
- A value to writeattribute
- Write an attribute valueIOException
public void writeValue(@Nullable Object value, @Nonnull ApiElement element, @Nullable String attributeName) throws IOException
value
- A value to write, where the null
value is ignored silently.element
- The elementattributeName
- A name of the XML attribute of null
value for a XML text.IOException
public final void writeRawValue(@Nonnull CharSequence rawValue, @Nonnull ApiElement element) throws IOException
rawValue
- A raw value to printelement
- An original elementIOException
public void writeNewLine(int level) throws IOException
IOException
@Nonnull public Appendable getWriter()
@Nonnull public Appendable getWriterEscaped()
@Nonnull public static Appendable createWriter(@Nonnull Object httpServletResponse, @Nonnull Charset charset, boolean noCache) throws ReflectiveOperationException
ReflectiveOperationException
Copyright 2019-2022, Pavel Ponec