char (int offset) { mySymbolLength = 1; char first = charAt(offset); if (first != '\\') return first; int pos = offset + 1; if (pos < myBufferEndOffset && charAt(pos) == '\\') return first; boolean escaped = true; int i = offset; while (--i >= 0 && charAt(i) == '\\') escaped = !escaped; if (!escaped) return first; if (pos < myBufferEndOffset && charAt(pos) != 'u') return first; //noinspection StatementWithEmptyBody while (++pos < myBufferEndOffset && charAt(pos) == 'u'); if (pos + 3 >= myBufferEndOffset) return first; int result = 0; for (int max = pos + 4; pos < max; pos++) { result <<= 4; char c = charAt(pos); if ('0' <= c && c <= '9') result += c - '0'; else if ('a' <= c && c <= 'f') result += (c - 'a') + 10; else if ('A' <= c && c <= 'F') result += (c - 'A') + 10; else return first; } mySymbolLength = pos - offset; return (char)result; }