MCPcopy
hub / github.com/google/gson / nextInObject

Method nextInObject

src/main/java/com/google/gson/stream/JsonReader.java:710–761  ·  view source on GitHub ↗
(boolean firstElement)

Source from the content-addressed store, hash-verified

708 }
709
710 @SuppressWarnings("fallthrough")
711 private JsonToken nextInObject(boolean firstElement) throws IOException {
712 /*
713 * Read delimiters. Either a comma/semicolon separating this and the
714 * previous name-value pair, or a close brace to denote the end of the
715 * object.
716 */
717 if (firstElement) {
718 /* Peek to see if this is the empty object. */
719 switch (nextNonWhitespace()) {
720 case '}':
721 pop();
722 hasToken = true;
723 return token = JsonToken.END_OBJECT;
724 default:
725 pos--;
726 }
727 } else {
728 switch (nextNonWhitespace()) {
729 case '}':
730 pop();
731 hasToken = true;
732 return token = JsonToken.END_OBJECT;
733 case ';':
734 case ',':
735 break;
736 default:
737 throw syntaxError("Unterminated object");
738 }
739 }
740
741 /* Read the name. */
742 int quote = nextNonWhitespace();
743 switch (quote) {
744 case '\'':
745 checkLenient(); // fall-through
746 case '"':
747 name = nextString((char) quote);
748 break;
749 default:
750 checkLenient();
751 pos--;
752 name = nextLiteral();
753 if (name.length() == 0) {
754 throw syntaxError("Expected name");
755 }
756 }
757
758 replaceTop(JsonScope.DANGLING_NAME);
759 hasToken = true;
760 return token = JsonToken.NAME;
761 }
762
763 private JsonToken objectValue() throws IOException {
764 /*

Callers 1

quickPeekMethod · 0.95

Calls 8

nextNonWhitespaceMethod · 0.95
popMethod · 0.95
syntaxErrorMethod · 0.95
checkLenientMethod · 0.95
nextStringMethod · 0.95
nextLiteralMethod · 0.95
replaceTopMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected