MCPcopy Create free account
hub / github.com/apache/solr / readEscapedChar

Method readEscapedChar

solr/solrj/src/java/org/noggit/JSONParser.java:668–700  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

666
667 // backslash has already been read when this is called
668 private char readEscapedChar() throws IOException {
669 int ch = getChar();
670 switch (ch) {
671 case '"':
672 return '"';
673 case '\'':
674 return '\'';
675 case '\\':
676 return '\\';
677 case '/':
678 return '/';
679 case 'n':
680 return '\n';
681 case 'r':
682 return '\r';
683 case 't':
684 return '\t';
685 case 'f':
686 return '\f';
687 case 'b':
688 return '\b';
689 case 'u':
690 return (char)
691 ((hexval(getChar()) << 12)
692 | (hexval(getChar()) << 8)
693 | (hexval(getChar()) << 4)
694 | (hexval(getChar())));
695 }
696 if ((flags & ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER) != 0 && ch != EOF) {
697 return (char) ch;
698 }
699 throw err("Invalid character escape");
700 }
701
702 // a dummy buffer we can use to point at other buffers
703 private final CharArr tmp = new CharArr(null, 0, 0);

Callers 2

readStringChars2Method · 0.95
readStringBareMethod · 0.95

Calls 3

getCharMethod · 0.95
hexvalMethod · 0.95
errMethod · 0.95

Tested by

no test coverage detected