@Test public void testSkipValue() throws IOException { String src = "{\"a\":[], \"b\":{}, \"c\": [{\"c\":null, \"d\":121212.02}, 4, null], \"e\":1234, \"end\":\"the end\"}"; JsonReader reader = createReader(src); reader.beginObject(); reader.next(); reader.skipValue(); assertTrue(reader.hasNext()); reader.next(); assertEquals(reader.name(), "b"); reader.skipValue(); assertTrue(reader.hasNext()); reader.next(); assertEquals(reader.name(), "c"); reader.skipValue(); assertTrue(reader.hasNext()); reader.next(); assertEquals(reader.name(), "e"); reader.skipValue(); assertTrue(reader.hasNext()); reader.next(); assertEquals(reader.name(), "end"); reader.endObject(); reader.close(); }
public ObjectReader skipValue() { if (ARRAY == valueType || OBJECT == valueType) { int balance = 0; do { if (ARRAY == valueType) { beginArray(); balance++; } else if (OBJECT == valueType) { beginObject(); balance++; } while (hasNext()) { next(); skipValue(); } JsonType type = _ctx.peek(); if (JsonType.ARRAY == type) { endArray(); balance--; } else if (JsonType.OBJECT == type) { endObject(); balance--; } } while (balance > 0); } return this; }
JsonReader implements ObjectReader { public ObjectReader skipValue() { if (ARRAY == valueType || OBJECT == valueType) { int balance = 0; do { if (ARRAY == valueType) { beginArray(); balance++; } else if (OBJECT == valueType) { beginObject(); balance++; } while (hasNext()) { next(); skipValue(); } JsonType type = _ctx.peek(); if (JsonType.ARRAY == type) { endArray(); balance--; } else if (JsonType.OBJECT == type) { endObject(); balance--; } } while (balance > 0); } return this; } }
JsonReader implements ObjectReader { public ObjectReader skipValue() { if (ARRAY == valueType || OBJECT == valueType) { int balance = 0; do { if (ARRAY == valueType) { beginArray(); balance++; } else if (OBJECT == valueType) { beginObject(); balance++; } while (hasNext()) { next(); skipValue(); } JsonType type = _ctx.peek(); if (JsonType.ARRAY == type) { endArray(); balance--; } else if (JsonType.OBJECT == type) { endObject(); balance--; } } while (balance > 0); } return this; } JsonReader(String source);  JsonReader(Reader reader, boolean strictDoubleParse, boolean readMetadata); }
JsonReader implements ObjectReader { public ObjectReader skipValue() { if (ARRAY == valueType || OBJECT == valueType) { int balance = 0; do { if (ARRAY == valueType) { beginArray(); balance++; } else if (OBJECT == valueType) { beginObject(); balance++; } while (hasNext()) { next(); skipValue(); } JsonType type = _ctx.peek(); if (JsonType.ARRAY == type) { endArray(); balance--; } else if (JsonType.OBJECT == type) { endObject(); balance--; } } while (balance > 0); } return this; } JsonReader(String source);  JsonReader(Reader reader, boolean strictDoubleParse, boolean readMetadata); void close(); ObjectReader beginArray(); ObjectReader beginObject(); ObjectReader nextObjectMetadata(); ObjectReader endArray(); ObjectReader endObject(); String name(); String valueAsString(); int valueAsInt(); long valueAsLong(); double valueAsDouble(); short valueAsShort(); float valueAsFloat(); boolean valueAsBoolean(); byte[] valueAsByteArray(); String metadata(String name); ValueType getValueType(); ObjectReader skipValue(); boolean hasNext(); ValueType next(); @Override JsonType enclosingType(); int column(); int row(); }
JsonReader implements ObjectReader { public ObjectReader skipValue() { if (ARRAY == valueType || OBJECT == valueType) { int balance = 0; do { if (ARRAY == valueType) { beginArray(); balance++; } else if (OBJECT == valueType) { beginObject(); balance++; } while (hasNext()) { next(); skipValue(); } JsonType type = _ctx.peek(); if (JsonType.ARRAY == type) { endArray(); balance--; } else if (JsonType.OBJECT == type) { endObject(); balance--; } } while (balance > 0); } return this; } JsonReader(String source);  JsonReader(Reader reader, boolean strictDoubleParse, boolean readMetadata); void close(); ObjectReader beginArray(); ObjectReader beginObject(); ObjectReader nextObjectMetadata(); ObjectReader endArray(); ObjectReader endObject(); String name(); String valueAsString(); int valueAsInt(); long valueAsLong(); double valueAsDouble(); short valueAsShort(); float valueAsFloat(); boolean valueAsBoolean(); byte[] valueAsByteArray(); String metadata(String name); ValueType getValueType(); ObjectReader skipValue(); boolean hasNext(); ValueType next(); @Override JsonType enclosingType(); int column(); int row();  }