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

Method nextEvent

solr/solrj/src/java/org/noggit/JSONParser.java:1044–1150  ·  view source on GitHub ↗

Returns the next event encountered in the JSON stream, one of #STRING #LONG #NUMBER #BIGNUMBER #BOOLEAN #NULL #OBJECT_START #OBJECT_END #OBJECT_END {@link #ARRAY_

()

Source from the content-addressed store, hash-verified

1042 * </ul>
1043 */
1044 public int nextEvent() throws IOException {
1045 if (valstate != 0) {
1046 if (valstate == STRING) {
1047 readStringChars2(devNull, start);
1048 } else if (valstate == BIGNUMBER) {
1049 continueNumber(devNull);
1050 }
1051 valstate = 0;
1052 }
1053
1054 int ch;
1055 outer:
1056 for (; ; ) {
1057 switch (state) {
1058 case 0:
1059 event = next(getChar());
1060 if (event == STRING && (flags & OPTIONAL_OUTER_BRACES) != 0) {
1061 if (start > 0) start--;
1062 missingOpeningBrace = true;
1063 stringTerm = 0;
1064 valstate = 0;
1065 event = next('{');
1066 }
1067 return event;
1068 case DID_OBJSTART:
1069 ch = getCharExpected('"');
1070 if (ch == '}') {
1071 pop();
1072 return event = OBJECT_END;
1073 }
1074 if (ch == '"') {
1075 stringTerm = ch;
1076 } else if (ch == ',' && (flags & ALLOW_EXTRA_COMMAS) != 0) {
1077 continue outer;
1078 } else {
1079 handleNonDoubleQuoteString(ch, true);
1080 }
1081 state = DID_MEMNAME;
1082 valstate = STRING;
1083 return event = STRING;
1084 case DID_MEMNAME:
1085 ch = getCharExpected(':');
1086 if (ch != ':') {
1087 if ((ch == '{' || ch == '[')
1088 && (flags & ALLOW_MISSING_COLON_COMMA_BEFORE_OBJECT) != 0) {
1089 start--;
1090 } else {
1091 throw err("Expected key,value separator ':'");
1092 }
1093 }
1094 state = DID_MEMVAL; // set state first because it might be pushed...
1095 return event = next(getChar());
1096 case DID_MEMVAL:
1097 ch = getCharExpected(',');
1098 if (ch == '}') {
1099 pop();
1100 return event = OBJECT_END;
1101 } else if (ch != ',') {

Callers 15

getParamsFromJSONMethod · 0.95
testCorruptionMethod · 0.95
errMethod · 0.95
testNumbersMethod · 0.95
testAPIMethod · 0.95
testRawFieldsMethod · 0.95
goToMethod · 0.95
getNumberCharsMethod · 0.95
parseMethod · 0.95
parseMethod · 0.45
checkEOFMethod · 0.45
ObjectBuilderMethod · 0.45

Calls 9

readStringChars2Method · 0.95
continueNumberMethod · 0.95
nextMethod · 0.95
getCharMethod · 0.95
getCharExpectedMethod · 0.95
popMethod · 0.95
errMethod · 0.95
getCharNWSMethod · 0.95

Tested by 6

testCorruptionMethod · 0.76
errMethod · 0.76
testNumbersMethod · 0.76
testAPIMethod · 0.76
testRawFieldsMethod · 0.76
parseMethod · 0.36