public class EntityUtilWriter extends PrintWriter
out
Constructor and Description |
---|
EntityUtilWriter(File file)
Constructor.
|
EntityUtilWriter(File file,
String csn)
Constructor.
|
EntityUtilWriter(OutputStream output)
Constructor.
|
EntityUtilWriter(OutputStream output,
boolean autoFlush)
Constructor.
|
EntityUtilWriter(String fileName)
Constructor.
|
EntityUtilWriter(String fileName,
String csn)
Constructor.
|
EntityUtilWriter(Writer output)
Constructor.
|
EntityUtilWriter(Writer output,
boolean autoFlush)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
EntityUtilWriter |
append(char c) |
EntityUtilWriter |
append(CharSequence csq) |
EntityUtilWriter |
append(CharSequence csq,
int start,
int end) |
EntityUtilWriter |
append(TextSource textSource,
Object... args)
Append the TextSource if
setLocaleContext(LocaleContext) has been called. |
EntityUtilWriter |
appendEmptyTagClose()
Print out close for an empty tag.
|
EntityUtilWriter |
appendEscapedAttribute(CharSequence name,
CharSequence value)
Append an Attribute.
|
EntityUtilWriter |
appendEscapedAttribute(String name,
TextSource value,
Object... args)
Append the TextSource for Attribute.
|
EntityUtilWriter |
appendEscapedData(CharSequence cdata)
Append escaped character data.
|
EntityUtilWriter |
appendEscapedData(TextSource textSource,
Object... args)
Append escaped TextSource.
|
EntityUtilWriter |
appendEscapedDataWithBreak(CharSequence cdata)
Append escaped character data with newlines converted to BR tags.
|
EntityUtilWriter |
appendEscapedDataWithBreak(TextSource textSource,
Object... args)
Append escaped TextSource with newlines converted to BR tags.
|
EntityUtilWriter |
appendHTMLAttribute(CharSequence name,
CharSequence value)
Append an HTML Attribute.
|
EntityUtilWriter |
appendHTMLData(CharSequence cdata)
Append HTML character data.
|
EntityUtilWriter |
appendHTMLDataWithBreak(CharSequence cdata)
Append HTML character data.
|
EntityUtilWriter |
appendXHTMLData(CharSequence cdata)
Append XHTML character data.
|
EntityUtilWriter |
appendXHTMLDataWithBreak(CharSequence cdata)
Append XHTML character data.
|
String |
escapeAttribute(CharSequence characters)
Escape characters for attributes.
|
String |
escapeData(CharSequence characters)
Escape characters for HTML/XHTML based on
isXHTML() . |
String |
escapeDataWithBreak(CharSequence characters)
Escape characters for HTML/XHTML based on
isXHTML() with newlines replaced with BR tags. |
String |
escapeHTML(CharSequence characters)
Escape characters for HTML.
|
String |
escapeHTMLWithBreak(CharSequence characters)
Escape characters for HTML with newlines replaced with BR tags.
|
String |
escapeXHTML(CharSequence characters)
Escape characters for XHTML.
|
String |
escapeXHTMLWithBreak(CharSequence characters)
Escape characters for XHTML with newlines replaced with BR tags.
|
EntityUtilWriter |
format(Locale l,
String format,
Object... args) |
EntityUtilWriter |
format(String format,
Object... args) |
EntityUtilWriter |
formatEscapedData(CharSequence format,
Object... args)
Format XHTML character data.
|
EntityUtilWriter |
formatEscapedDataWithBreak(CharSequence format,
Object... args)
Format XHTML character data.
|
EntityUtilWriter |
formatHTMLData(CharSequence format,
Object... args)
Format HTML character data.
|
EntityUtilWriter |
formatHTMLDataWithBreak(CharSequence format,
Object... args)
Format HTML character data.
|
EntityUtilWriter |
formatXHTMLData(CharSequence format,
Object... args)
Format escaped character data.
|
EntityUtilWriter |
formatXHTMLDataWithBreak(CharSequence format,
Object... args)
Format XHTML character data.
|
EntityUtil |
getAttributeEscapeUtil()
Get the attribute escaper used by the writer.
|
EntityUtil |
getDataEscapeUtil()
Get the data escaper used by the writer.
|
EntityUtil |
getHTMLEscapeUtil()
Get the HTML data escaper used by the writer.
|
Locale |
getLocale()
Get locale used for formatting..
|
LocaleContext |
getLocaleContext()
Get the locale context.
|
EntityUtil |
getXHTMLEscapeUtil()
Get the XHTML data escaper used by the writer.
|
boolean |
isXHTML()
Get the XHTML flag.
|
void |
printEmptyTagClose()
Print out close for an empty tag.
|
void |
printEscapedAttribute(CharSequence name,
CharSequence value)
Print an Attribute.
|
void |
printEscapedData(CharSequence cdata)
Print escaped character data.
|
void |
printEscapedDataWithBreak(CharSequence cdata)
Print escaped character data.
|
void |
printHTMLAttribute(CharSequence name,
CharSequence value)
Print an HTML Attribute.
|
void |
printHTMLData(CharSequence cdata)
Print HTML character data.
|
void |
printHTMLDataWithBreak(CharSequence cdata)
Print HTML character data.
|
void |
printlnEmptyTagClose()
Print out close for an empty tag.
|
void |
printXHTMLData(CharSequence cdata)
Print XHTML character data.
|
void |
printXHTMLDataWithBreak(CharSequence cdata)
Print XHTML character data.
|
void |
setLocale(Locale locale)
Set the locale used for formatting.
|
void |
setLocaleContext(LocaleContext localeContext)
Set the locale context to be used by methods that take a TextSource.
|
void |
setXHTML(boolean xhtml)
Set the XHTML.
|
public EntityUtilWriter(File file) throws FileNotFoundException
file
- the file.FileNotFoundException
- if the file is not found.public EntityUtilWriter(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException
file
- the file.csn
- character set name.FileNotFoundException
- if the file isn't found.UnsupportedEncodingException
- if the character set is unsupported.public EntityUtilWriter(OutputStream output)
output
- the stream.public EntityUtilWriter(OutputStream output, boolean autoFlush)
output
- the stream.autoFlush
- flush flag.public EntityUtilWriter(String fileName) throws FileNotFoundException
fileName
- the file name.FileNotFoundException
- if the file is not found.public EntityUtilWriter(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException
fileName
- the file name.csn
- character set name.FileNotFoundException
- if the file isn't found.UnsupportedEncodingException
- if the character set is unsupported.public EntityUtilWriter(Writer output)
output
- the writer.public EntityUtilWriter(Writer output, boolean autoFlush)
output
- the writer.autoFlush
- flush flag.public EntityUtilWriter append(char c)
append
in interface Appendable
append
in class PrintWriter
public EntityUtilWriter append(CharSequence csq)
append
in interface Appendable
append
in class PrintWriter
public EntityUtilWriter append(CharSequence csq, int start, int end)
append
in interface Appendable
append
in class PrintWriter
public EntityUtilWriter append(@Nonnull TextSource textSource, @Nullable Object... args) throws IllegalStateException
setLocaleContext(LocaleContext)
has been called.textSource
- the TextSource.args
- optional arguments.IllegalStateException
- if the LocaleContext is not set.public EntityUtilWriter appendEmptyTagClose()
This will be either "/>"
or ">"
. depending on isXHTML()
.
LINK
, INPUT
, etc.public EntityUtilWriter appendEscapedAttribute(CharSequence name, CharSequence value)
isXHTML()
.name
- the name.value
- the value.public EntityUtilWriter appendEscapedAttribute(String name, TextSource value, @Nullable Object... args) throws IllegalStateException
setLocaleContext(LocaleContext)
must have been called.name
- the name.value
- the value.args
- optional arguments.IllegalStateException
- if the LocaleContext is not set.public EntityUtilWriter appendEscapedData(CharSequence cdata)
isXHTML()
.cdata
- the character data.public EntityUtilWriter appendEscapedData(@Nonnull TextSource textSource, @Nullable Object... args) throws IllegalStateException
setLocaleContext(LocaleContext)
must have been called.textSource
- the TextSource.args
- optional arguments.IllegalStateException
- if the LocaleContext is not set.public EntityUtilWriter appendEscapedDataWithBreak(CharSequence cdata)
isXHTML()
.cdata
- the character data.public EntityUtilWriter appendEscapedDataWithBreak(@Nonnull TextSource textSource, @Nullable Object... args) throws IllegalStateException
setLocaleContext(LocaleContext)
must have been called.textSource
- the TextSource.args
- optional arguments.IllegalStateException
- if the LocaleContext is not set.public EntityUtilWriter appendHTMLAttribute(CharSequence name, CharSequence value)
name
- the name.value
- the value.public EntityUtilWriter appendHTMLData(CharSequence cdata)
cdata
- the character data.public EntityUtilWriter appendHTMLDataWithBreak(CharSequence cdata)
cdata
- the character data.public EntityUtilWriter appendXHTMLData(CharSequence cdata)
cdata
- the character data.public EntityUtilWriter appendXHTMLDataWithBreak(CharSequence cdata)
cdata
- the character data.public String escapeAttribute(CharSequence characters)
This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeData(CharSequence characters)
isXHTML()
. This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeDataWithBreak(CharSequence characters)
isXHTML()
with newlines replaced with BR tags. This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeHTML(CharSequence characters)
This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeHTMLWithBreak(CharSequence characters)
This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeXHTML(CharSequence characters)
This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public String escapeXHTMLWithBreak(CharSequence characters)
This returns the escaped characters instead of writing them to the writer. This is useful when combined with other escaping before output via this writer.
characters
- the characters.public EntityUtilWriter format(Locale l, @Nonnull String format, @Nullable Object... args)
format
in class PrintWriter
public EntityUtilWriter format(@Nonnull String format, Object... args)
format
in class PrintWriter
public EntityUtilWriter formatEscapedData(CharSequence format, Object... args)
isXHTML()
.format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtilWriter formatEscapedDataWithBreak(CharSequence format, Object... args)
isXHTML()
.format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtilWriter formatHTMLData(CharSequence format, Object... args)
format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtilWriter formatHTMLDataWithBreak(CharSequence format, Object... args)
format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtilWriter formatXHTMLData(CharSequence format, Object... args)
format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtilWriter formatXHTMLDataWithBreak(CharSequence format, Object... args)
format
- A format string as described in Format string syntax.args
- Arguments referenced by the format specifiers in the format string. If there are more arguments than format
specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The maximum number of
arguments is limited by the maximum dimension of a Java array as defined by the
Java
Virtual Machine Specification. The behaviour on a null argument depends on the conversion.public EntityUtil getAttributeEscapeUtil()
public EntityUtil getDataEscapeUtil()
public EntityUtil getHTMLEscapeUtil()
public Locale getLocale()
@Nullable public LocaleContext getLocaleContext()
public EntityUtil getXHTMLEscapeUtil()
public boolean isXHTML()
public void printEmptyTagClose()
This will be either "/>"
or ">"
. depending on isXHTML()
.
LINK
, INPUT
, etc.public void printEscapedAttribute(CharSequence name, CharSequence value)
isXHTML()
.name
- the name.value
- the value.public void printEscapedData(CharSequence cdata)
isXHTML()
.cdata
- the character data.public void printEscapedDataWithBreak(CharSequence cdata)
isXHTML()
.cdata
- the character data.public void printHTMLAttribute(CharSequence name, CharSequence value)
name
- the name.value
- the value.public void printHTMLData(CharSequence cdata)
cdata
- the character data.public void printHTMLDataWithBreak(CharSequence cdata)
cdata
- the character data.public void printlnEmptyTagClose()
This will be either "/>"
or ">"
. depending on isXHTML()
.
LINK
, INPUT
, etc.public void printXHTMLData(CharSequence cdata)
cdata
- the character data.public void printXHTMLDataWithBreak(CharSequence cdata)
cdata
- the character data.public void setLocale(Locale locale)
locale
- the locale.public void setLocaleContext(LocaleContext localeContext)
localeContext
- the locale context.public void setXHTML(boolean xhtml)
xhtml
- the XHTML flag.