public class NullWriter extends java.lang.Object implements NestedMarkupWriter
IMarkupWriter
that does absolutely nothing; this is used during the rewind
phase of the request cycle when output is discarded anyway.Constructor and Description |
---|
NullWriter() |
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
IMarkupWriter.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()
Always returns false.
|
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 |
getBuffer()
Returns any makrup so far accumulated by the nested markup writer.
|
java.lang.String |
getContentType()
Returns the type of content generated by this response writer, as a MIME type.
|
NestedMarkupWriter |
getNestedWriter()
Returns
this : since a NullWriter doesn't actually do anything, one is as good
as another!. |
static IMarkupWriter |
getSharedInstance() |
void |
print(char value)
Prints a single character, or its equivalent entity.
|
void |
print(char[] data,
int offset,
int length)
Version of
IMarkupWriter.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
IMarkupWriter.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
IMarkupWriter.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
IMarkupWriter.print(char[], int, int, boolean) that assumes filter is enabled. |
void |
printRaw(java.lang.String value)
As with
IMarkupWriter.print(char[], int, int, boolean) , but the data to print is defined by the
String. |
public NullWriter()
public static IMarkupWriter getSharedInstance()
public java.lang.String getBuffer()
NestedMarkupWriter
IMarkupWriter.printRaw(String)
,
with this content, on its parent markup writer.
Getting the buffer will close the writer.
getBuffer
in interface NestedMarkupWriter
public void printRaw(char[] buffer, int offset, int length)
IMarkupWriter
IMarkupWriter.print(char[], int, int, boolean)
that assumes filter is enabled.printRaw
in interface IMarkupWriter
public void printRaw(java.lang.String value)
IMarkupWriter
IMarkupWriter.print(char[], int, int, boolean)
, but the data to print is defined by the
String. Assumes filtering is disabled.printRaw
in interface IMarkupWriter
public void println()
IMarkupWriter
println
in interface IMarkupWriter
public void print(char[] data, int offset, int length)
IMarkupWriter
IMarkupWriter.print(char[], int, int, boolean)
that assumes filter is
enabled.print
in interface IMarkupWriter
public void print(char value)
IMarkupWriter
Closes any open tag.
print
in interface IMarkupWriter
public void print(int value)
IMarkupWriter
Closes any open tag.
print
in interface IMarkupWriter
public void print(java.lang.String value)
IMarkupWriter
IMarkupWriter.print(char[], int, int, boolean)
, but the data to print is defined by the
String. Assumes filtering is enabled.print
in interface IMarkupWriter
public NestedMarkupWriter getNestedWriter()
this
: since a NullWriter doesn't actually do anything, one is as good
as another!.getNestedWriter
in interface IMarkupWriter
public java.lang.String getContentType()
IMarkupWriter
getContentType
in interface IMarkupWriter
public void flush()
IMarkupWriter
flush()
to this IMarkupWriter
's
PrintWriter
.flush
in interface IMarkupWriter
public void end()
IMarkupWriter
end
in interface IMarkupWriter
public void end(java.lang.String name)
IMarkupWriter
end
in interface IMarkupWriter
public void comment(java.lang.String value)
IMarkupWriter
<!--
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 IMarkupWriter.printRaw(String)
.
comment
in interface IMarkupWriter
public void closeTag()
IMarkupWriter
attribute()
methods may not be used until a new element is opened
with IMarkupWriter.begin(String)
or or IMarkupWriter.beginEmpty(String)
.closeTag
in interface IMarkupWriter
public void close()
IMarkupWriter
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.close
in interface IMarkupWriter
public boolean checkError()
checkError
in interface IMarkupWriter
public void beginEmpty(java.lang.String name)
IMarkupWriter
end()
call. This is
useful for elements that do not need closing tags.beginEmpty
in interface IMarkupWriter
public void begin(java.lang.String name)
IMarkupWriter
begin
in interface IMarkupWriter
public void attribute(java.lang.String name, int value)
IMarkupWriter
attribute
in interface IMarkupWriter
public void attribute(java.lang.String name, java.lang.String value)
IMarkupWriter
IMarkupWriter.begin(String)
and before any other kind of writing (which closes the tag).
The value may be null.
attribute
in interface IMarkupWriter
public void attribute(java.lang.String name, boolean value)
IMarkupWriter
attribute
in interface IMarkupWriter
IMarkupWriter.attribute(java.lang.String, boolean)
public void attributeRaw(java.lang.String name, java.lang.String value)
IMarkupWriter
IMarkupWriter.attribute(String, String)
but no escaping of invalid elements is done for
the value.attributeRaw
in interface IMarkupWriter
IMarkupWriter.attributeRaw(java.lang.String, java.lang.String)
public void print(char[] data, int offset, int length, boolean raw)
IMarkupWriter
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.
print
in interface IMarkupWriter
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 disabledpublic void print(java.lang.String value, boolean raw)
IMarkupWriter
IMarkupWriter.print(char[], int, int, boolean)
, but the data to print is defined by the
String.print
in interface IMarkupWriter