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 @NotNull 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 @NotNull 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(@NotNull Appendable out,
@NotNull XmlConfig config)
A writer constructor
|
| Modifier and Type | Method and Description |
|---|---|
static @NotNull Appendable |
createWriter(@NotNull Object httpServletResponse,
@NotNull Charset charset,
boolean noCache)
Assign a no-cache and an Edge compatibility mode and returns a writer from HttpServletResponse
|
@NotNull Appendable |
getWriter()
For internal usage only
|
@NotNull Appendable |
getWriterEscaped()
Get Writer to escape HTML characters.
|
String |
toString() |
void |
write(@NotNull 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(@NotNull CharSequence rawValue,
@NotNull ApiElement element)
Write the content of an envelope
|
void |
writeValue(@Nullable Object value,
@NotNull ApiElement element,
@Nullable 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
@NotNull protected final @NotNull Appendable out
@NotNull protected final @NotNull XmlConfig config
protected final boolean indentationEnabled
public AbstractWriter(@NotNull
@NotNull Appendable out,
@NotNull
@NotNull XmlConfig config)
out - A writerconfig - XML configurationpublic final void write(@NotNull
@NotNull CharSequence text,
boolean attribute)
throws IOException
text - A value to writeattribute - Write an attribute valueIOExceptionpublic void writeValue(@Nullable
@Nullable Object value,
@NotNull
@NotNull ApiElement element,
@Nullable
@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.IOExceptionpublic final void writeRawValue(@NotNull
@NotNull CharSequence rawValue,
@NotNull
@NotNull ApiElement element)
throws IOException
rawValue - A raw value to printelement - An original elementIOExceptionpublic void writeNewLine(int level)
throws IOException
IOException@NotNull public @NotNull Appendable getWriter()
@NotNull public @NotNull Appendable getWriterEscaped()
@NotNull public static @NotNull Appendable createWriter(@NotNull @NotNull Object httpServletResponse, @NotNull @NotNull Charset charset, boolean noCache) throws ReflectiveOperationException
ReflectiveOperationExceptionCopyright 2015, Pavel Ponec