This package methods read JEXL string literals and handle escaping through the 'backslash' (ie: \) character. Escaping is used to neutralize string delimiters (the single and double quotes) and read Unicode hexadecimal encoded characters.
The only escapable characters are the single and double quotes - ''' and '"' -, a Unicode sequence starting with 'u' followed by 4 hexadecimals and the backslash character - '\' - itself.
A sequence where '\' occurs before any non-escapable character or sequence has no effect, the sequence output being the same as the input.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | BASE10
The base 10 offset used to convert hexa characters to decimal. |
| private static final char | FIRST_ASCII
The first printable 7bits ascii character. |
| private static final char | LAST_ASCII
The last 7bits ascii character. |
| private static final int | SHIFT
Initial shift value for composing a Unicode char from 4 nibbles (16 - 4). |
| private static final int | UCHAR_LEN
The length of an escaped unicode sequence. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static String | Returns: the built stringthe string to build from str, boolean whether the separator, the first character, should be considered eatsep)Builds a string, handles escaping through '\' syntax. |
| public static String | Returns: the escaped representationthe string to escape str, char delim)Escapes a String representation, expand non-ASCII characters as Unicode escape sequence. |
| private static int | Returns: the last character offset handled in originthe destination buffer to copy characters into strb, CharSequence the origin str, int the relative offset in str to begin reading begin, int the relative offset in str to end reading end, char the separator, single or double quote, marking end of string sep)Read the remainder of a string till a given separator, handles escaping through '\' syntax. |
| public static int | Returns: the offset in originthe destination buffer to copy characters into strb, CharSequence the origin str, int the offset into the origin index, char the separator, single or double quote, marking end of string sep)Read the remainder of a string till a given separator, handles escaping through '\' syntax. |
| private static int | Returns: 0 if char could not be read, 4 otherwisethe builder to write the character to strb, CharSequence the sequence str, int the begin offset in sequence (after the '\\u') begin)Reads a Unicode escape character. |
| BASE10 | back to summary |
|---|---|
| private static final int BASE10 The base 10 offset used to convert hexa characters to decimal. | |
| FIRST_ASCII | back to summary |
|---|---|
| private static final char FIRST_ASCII The first printable 7bits ascii character. | |
| LAST_ASCII | back to summary |
|---|---|
| private static final char LAST_ASCII The last 7bits ascii character. | |
| SHIFT | back to summary |
|---|---|
| private static final int SHIFT Initial shift value for composing a Unicode char from 4 nibbles (16 - 4). | |
| UCHAR_LEN | back to summary |
|---|---|
| private static final int UCHAR_LEN The length of an escaped unicode sequence. | |
| StringParser | back to summary |
|---|---|
| public StringParser() Default constructor. | |
| buildString | back to summary |
|---|---|
| public static String buildString(CharSequence str, boolean eatsep) Builds a string, handles escaping through '\' syntax.
| |
| escapeString | back to summary |
|---|---|
| public static String escapeString(String str, char delim) Escapes a String representation, expand non-ASCII characters as Unicode escape sequence. | |
| read | back to summary |
|---|---|
| private static int read(StringBuilder strb, CharSequence str, int begin, int end, char sep) Read the remainder of a string till a given separator, handles escaping through '\' syntax.
| |
| readString | back to summary |
|---|---|
| public static int readString(StringBuilder strb, CharSequence str, int index, char sep) Read the remainder of a string till a given separator, handles escaping through '\' syntax.
| |
| readUnicodeChar | back to summary |
|---|---|
| private static int readUnicodeChar(StringBuilder strb, CharSequence str, int begin) Reads a Unicode escape character.
| |