Class XMLEscapeUtil
java.lang.Object
com.atlassian.jira.imports.project.util.XMLEscapeUtil
Replaces all characters that are illegal in XML with a escape sequence '☃[0-9][0-9][0-9][0-9]'.
Additionally ☃ character is also escaped to ensure that decoding encoded text will ne the same.
- Since:
- v6.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringunicodeDecode(String string) Substitutes all occurrences of '☃[0-9][0-9][0-9][0-9]' with their corresponding character codes.static StringunicodeEncode(String string) Replaces all characters that are illegal in XML with a Java-like unicode escape sequence '☃[0-9][0-9][0-9][0-9]'.static intunicodeInPlaceEncode(char[] cbuf, int off, int len, int maxLen, Queue<Character> overflow) Escaping characters in place in given buffer.
-
Field Details
-
ESCAPING_CHAR
public static final char ESCAPING_CHAR- See Also:
-
-
Constructor Details
-
XMLEscapeUtil
public XMLEscapeUtil()
-
-
Method Details
-
unicodeEncode
Replaces all characters that are illegal in XML with a Java-like unicode escape sequence '☃[0-9][0-9][0-9][0-9]'. Whennullis passed into this method,nullis returned. -
unicodeDecode
Substitutes all occurrences of '☃[0-9][0-9][0-9][0-9]' with their corresponding character codes. Whennullis passed into this method,nullis returned. -
unicodeInPlaceEncode
public static int unicodeInPlaceEncode(char[] cbuf, int off, int len, int maxLen, Queue<Character> overflow) Escaping characters in place in given buffer. Because escaped character is encoded with more than one character it is quite possible that it won't fit in buffer. Additional characters in escaped form if needed will be added to overflow queue. Buffer is analyzed from offset for len characters. Buffer may be longer but not filled - maxLen is maximum buffer length that can be used.- Parameters:
cbuf- buffer with data - it will be overwritten with escaped dataoff- offset of characters in buffer to be analyzed and escaped if neededlen- number of characters to be analyzedmaxLen- maximum number of characters that can be put into buffer (counting from offset)overflow- should be empty when called, used to return overflow data- Returns:
- number of characters in buffer starting from offset at the end of function
-