public interface IMarkupWriter
IMarkupWriter
handles translation from unicode to the markup language (escaping
characters such as '<' and '>' to their entity equivalents, '<' and '>') as
well as assisting with nested elements, closing tags, etc.Modifier and Type | Method and Description |
---|---|
void |
attribute(java.lang.String name,
boolean value)
Writes a boolean attribute into the currently open tag.
|
void |
attribute(java.lang.String name,
int value)
Writes an integer attribute into the currently open tag.
|
void |
attribute(java.lang.String name,
java.lang.String value)
Writes an attribute into the most recently opened tag.
|
void |
attributeRaw(java.lang.String name,
java.lang.String value)
Similar to
attribute(String, String) but no escaping of invalid elements is done for
the value. |
void |
begin(java.lang.String name)
Closes any existing tag then starts a new element.
|
void |
beginEmpty(java.lang.String name)
Starts an element that will not later be matched with an
end() call. |
boolean |
checkError()
Invokes checkError() on the
PrintWriter used to format output. |
void |
close()
Closes this
IMarkupWriter . |
void |
closeTag()
Closes the most recently opened element by writing the '>' that ends it.
|
void |
comment(java.lang.String value)
Writes an XML/HTML comment.
|
void |
end()
Ends the element most recently started by .
|
void |
end(java.lang.String name)
Ends the most recently started element with the given name.
|
void |
flush()
Forwards
flush() to this IMarkupWriter 's
PrintWriter . |
java.lang.String |
getContentType()
Returns the type of content generated by this response writer, as a MIME type.
|
NestedMarkupWriter |
getNestedWriter()
Returns a nested writer, one that accumulates its changes in a buffer.
|
void |
print(char value)
Prints a single character, or its equivalent entity.
|
void |
print(char[] data,
int offset,
int length)
Version of
print(char[], int, int, boolean) that assumes filter is
enabled. |
void |
print(char[] data,
int offset,
int length,
boolean raw)
The primary
print() method, used by most other methods. |
void |
print(int value)
Prints an integer.
|
void |
print(java.lang.String value)
As with
print(char[], int, int, boolean) , but the data to print is defined by the
String. |
void |
print(java.lang.String value,
boolean raw)
As with
print(char[], int, int, boolean) , but the data to print is defined by the
String. |
void |
println()
Closes the open tag (if any), then prints a line seperator to the output stream.
|
void |
printRaw(char[] buffer,
int offset,
int length)
Version of
print(char[], int, int, boolean) that assumes filter is enabled. |
void |
printRaw(java.lang.String value)
As with
print(char[], int, int, boolean) , but the data to print is defined by the
String. |
void attribute(java.lang.String name, int value)
java.lang.IllegalStateException
- if there is no open tag.void attribute(java.lang.String name, boolean value)
java.lang.IllegalStateException
- if there is no open tag.void attribute(java.lang.String name, java.lang.String value)
begin(String)
and before any other kind of writing (which closes the tag).
The value may be null.
java.lang.IllegalStateException
- if there is no open tag.void attributeRaw(java.lang.String name, java.lang.String value)
attribute(String, String)
but no escaping of invalid elements is done for
the value.java.lang.IllegalStateException
- if there is no open tag.void begin(java.lang.String name)
void beginEmpty(java.lang.String name)
end()
call. This is
useful for elements that do not need closing tags.boolean checkError()
PrintWriter
used to format output.void close()
IMarkupWriter
. Close tags are written for any active elements.
The PrintWriter
is then sent close()
. A nested writer will
commit its buffer to its containing writer.void closeTag()
attribute()
methods may not be used until a new element is opened
with begin(String)
or or beginEmpty(String)
.void comment(java.lang.String value)
<!--
and -->
, and provides a blank line after the
close of the comment.
Most characters are valid inside a comment, so no check of the contents is made
(much like printRaw(String)
.
void end()
void end(java.lang.String name)
void flush()
flush()
to this IMarkupWriter
's
PrintWriter
.NestedMarkupWriter getNestedWriter()
IMarkupWriter
using printRaw(String)
.void print(char[] data, int offset, int length)
print(char[], int, int, boolean)
that assumes filter is
enabled.void print(char[] data, int offset, int length, boolean raw)
print()
method, used by most other methods.
Prints the character array, first closing any open tag. Problematic characters ('<', '>' and '&') are converted to appropriate entities.
Does nothing if data
is null.
Closes any open tag.
data
- contains the characters to print, or null to not print anythingoffset
- offset into the array to start printing fromlength
- number of characters to printraw
- if true, filtering is disabledvoid print(char value)
Closes any open tag.
void print(int value)
Closes any open tag.
void print(java.lang.String value)
print(char[], int, int, boolean)
, but the data to print is defined by the
String. Assumes filtering is enabled.void print(java.lang.String value, boolean raw)
print(char[], int, int, boolean)
, but the data to print is defined by the
String.void println()
void printRaw(char[] buffer, int offset, int length)
print(char[], int, int, boolean)
that assumes filter is enabled.void printRaw(java.lang.String value)
print(char[], int, int, boolean)
, but the data to print is defined by the
String. Assumes filtering is disabled.java.lang.String getContentType()