in johnzon-core/src/main/java/org/apache/johnzon/core/JsonStreamParserImpl.java [407:509]
protected final Event internalNext() {
//main entry, make decision how to handle the current character in the stream
if (!hasNext()) {
final char c = readNextChar();
unreadChar();
if (c != EOF) {
throw uexc("No available event");
}
throw new NoSuchElementException();
}
if (previousEvent > 0 && currentStructureElement == null) {
throw uexc("Unexpected end of structure");
}
final char c = readNextNonWhitespaceChar(readNextChar());
if (c == COMMA_CHAR) {
//last event must one of the following-> " ] } LITERAL
if (previousEvent == KEY_SEPARATOR_EVENT || previousEvent == START_ARRAY
|| previousEvent == START_OBJECT || previousEvent == COMMA_EVENT
|| previousEvent == KEY_NAME) {
throw uexc("Expected \" ] } LITERAL");
}
previousEvent = COMMA_EVENT;
return internalNext();
}
if (c == KEY_SEPARATOR) {
if (previousEvent != KEY_NAME) {
throw uexc("A : can only follow a key name");
}
previousEvent = KEY_SEPARATOR_EVENT;
return internalNext();
}
if (!isCurrentNumberIntegral) {
isCurrentNumberIntegral = true;
}
// if (currentBigDecimalNumber != null) {
// currentBigDecimalNumber = null;
// }
if (currentIntegralNumber != Integer.MIN_VALUE) {
currentIntegralNumber = Integer.MIN_VALUE;
}
releasePreviousFallBackCopyBuffers();
if (fallBackCopyBufferLength != 0) {
fallBackCopyBufferLength = 0;
}
startOfValueInBuffer = endOfValueInBuffer = -1;
switch (c) {
case START_OBJECT_CHAR:
return handleStartObject();
case END_OBJECT_CHAR:
return handleEndObject();
case START_ARRAY_CHAR:
return handleStartArray();
case END_ARRAY_CHAR:
return handleEndArray();
case QUOTE_CHAR:
return handleQuote();
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case MINUS:
case FALSE_F: // false
case TRUE_T: // true
case NULL_N: // null
return handleLiteral();
default:
return defaultHandling(c);
}
}