@InterfaceAudience.Private public final class HtmlQuoting extends Object
Modifier and Type | Field and Description |
---|---|
private static byte[] |
ampBytes |
private static byte[] |
aposBytes |
private static byte[] |
gtBytes |
private static byte[] |
ltBytes |
private static byte[] |
quotBytes |
Modifier | Constructor and Description |
---|---|
private |
HtmlQuoting() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
static boolean |
needsQuoting(byte[] data,
int off,
int len)
Does the given string need to be quoted?
|
static boolean |
needsQuoting(String str)
Does the given string need to be quoted?
|
static void |
quoteHtmlChars(OutputStream output,
byte[] buffer,
int off,
int len)
Quote all of the active HTML characters in the given string as they
are added to the buffer.
|
static String |
quoteHtmlChars(String item)
Quote the given item to make it html-safe.
|
static OutputStream |
quoteOutputStream(OutputStream out)
Return an output stream that quotes all of the output.
|
static String |
unquoteHtmlChars(String item)
Remove HTML quoting from a string.
|
private static final byte[] ampBytes
private static final byte[] aposBytes
private static final byte[] gtBytes
private static final byte[] ltBytes
private static final byte[] quotBytes
private HtmlQuoting()
public static boolean needsQuoting(byte[] data, int off, int len)
data
- the string to checkoff
- the starting positionlen
- the number of bytes to checkpublic static boolean needsQuoting(String str)
str
- the string to checkpublic static void quoteHtmlChars(OutputStream output, byte[] buffer, int off, int len) throws IOException
output
- the stream to write the output tobuffer
- the byte array to take the characters fromoff
- the index of the first byte to quotelen
- the number of bytes to quoteIOException
public static String quoteHtmlChars(String item)
item
- the string to quotepublic static OutputStream quoteOutputStream(OutputStream out) throws IOException
out
- the stream to write the quoted output toIOException
- if the underlying output failspublic static String unquoteHtmlChars(String item)
item
- the string to unquoteCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.