Package sk.antons.json.util
Class JsonEscaper
java.lang.Object
sk.antons.json.util.JsonEscaper
Json string escaper for string literals.
- Author:
- antons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringEscape input string.static StringEscape input string.static StringEscape input string.static StringescapeChar(int c) Escapes characterstatic voidstatic StringUnescape stringstatic StringUnescape stringstatic charunescapeChar(String value) Unescape escaped string into character.static charunescapeChar(String value, int pos) Unescape escaped string into character.
-
Constructor Details
-
JsonEscaper
public JsonEscaper()
-
-
Method Details
-
escapeChar
Escapes character- Parameters:
c- input character- Returns:
- escaped sequence for provided input
-
unescapeChar
Unescape escaped string into character.- Parameters:
value- escapes sequence- Returns:
- char defined by input.
-
unescapeChar
Unescape escaped string into character.- Parameters:
value- stringpos- position of escape sequence in string- Returns:
- char defined by input.
-
escape
Escape input string.- Parameters:
value- input string- Returns:
- escaped string.
-
escape
Escape input string.- Parameters:
value- input stringescapeNonAscii- escape non asci charasters- Returns:
- escaped string
-
escape
Escape input string.- Parameters:
value- input stringescapeNonAscii- escape non asci charastersoffset- start position of string to be escapedlength- length of string to be escaped- Returns:
- escaped string
-
unescape
Unescape string- Parameters:
value- escaped string- Returns:
- unescaped string
-
unescape
Unescape string- Parameters:
value- escaped stringoffset- start position of string to be unescapedlength- length of string to be unescaped- Returns:
- unescaped string
-
main
-