本文整理了Java中javax.json.stream.JsonParser.next()
方法的一些代码示例,展示了JsonParser.next()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonParser.next()
方法的具体详情如下:
包路径:javax.json.stream.JsonParser
类名称:JsonParser
方法名:next
[英]Returns the event for the next parsing state.
[中]返回下一个分析状态的事件。
代码示例来源:origin: dcm4che/dcm4che
public JsonParser.Event next() {
s = null;
return event = parser.next();
}
代码示例来源:origin: dcm4che/dcm4che
private Event next() {
s = null;
return event = parser.next();
}
代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime
/**
* Returns the next event.
*/
public JsonParser.Event next() {
return parser.next();
}
代码示例来源:origin: apache/johnzon
@Override
public Event next() {
return jsonParser.next();
}
代码示例来源:origin: org.apache.johnzon/johnzon-core
@Override
public Event next() {
return jsonParser.next();
}
代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime
/**
* Checks that the next event is of the given type, and throw and exception if it isn't.
*/
public void expect(JsonParser.Event expected) {
JsonParser.Event actual = parser.next();
if (actual != expected) {
throw new JsonException("Unexpected event");
}
}
代码示例来源:origin: stackoverflow.com
String jsonString="";
JsonParser jParser= Json.createParser(new ByteArrayInputStream(jsonString.getBytes()));
while(jParser.hasNext()){
if(jParser.next()==Event.KEY_NAME){
if(jParser.getString().equals("viewCount")){
jParser.next();
System.out.println(jParser.getString());
}
}
}
代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime
/**
* Reads an integer value from the JSON parser.
*/
public BigInteger readInteger() {
JsonParser.Event event = parser.next();
switch (event) {
case VALUE_NUMBER:
return parser.getBigDecimal().toBigInteger();
default:
throw new JsonException("Expected integer value");
}
}
代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime
/**
* Reads a decimal value from the JSON parser.
*/
public BigDecimal readDecimal() {
JsonParser.Event event = parser.next();
switch (event) {
case VALUE_NUMBER:
return parser.getBigDecimal();
default:
throw new JsonException("Expected decimal value");
}
}
代码示例来源:origin: org.opendaylight.aaa/aaa-authn-idpmapping
public Object loadJson(java.io.Reader in) {
JsonParser parser = Json.createParser(in);
Event event = null;
// Prime the pump. Get the first item from the parser.
event = parser.next();
// Act on first item.
return loadJsonItem(parser, event);
}
代码示例来源:origin: org.eclipse/yasson
/**
* Get root value event, either for new deserialization process, or deserialization sub-process invoked from
* custom user deserializer.
*/
private JsonParser.Event getRootEvent(JsonParser parser) {
if (parser.getLocation().getStreamOffset() == 0) {
return parser.next();
}
final JsonParser.Event lastEvent = ((JsonbParser) parser).getCurrentLevel().getLastEvent();
return lastEvent == JsonParser.Event.KEY_NAME ? parser.next() : lastEvent;
}
代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime
/**
* Reads a string value from the JSON parser.
*/
public String readString() {
JsonParser.Event event = parser.next();
switch (event) {
case VALUE_STRING:
return parser.getString();
default:
throw new JsonException("Expected string value");
}
}
代码示例来源:origin: webex/spark-java-sdk
private static <T> T readJson(Class<T> clazz, InputStream inputStream) {
JsonParser parser = Json.createParser(inputStream);
parser.next();
return readObject(clazz, parser);
}
代码示例来源:origin: agoncal/agoncal-book-javaee7
public String parsePurchaseOrderAndReturnEmail() throws FileNotFoundException {
String email = null;
JsonParser parser = Json.createParser(new FileReader("src/main/resources/order.json"));
while (parser.hasNext()) {
JsonParser.Event event = parser.next();
while (parser.hasNext() && !(event.equals(JsonParser.Event.KEY_NAME) && parser.getString().matches("email"))) {
event = parser.next();
}
if (event.equals(JsonParser.Event.KEY_NAME) && parser.getString().matches("email")) {
parser.next();
email = parser.getString();
}
}
return email;
}
}
代码示例来源:origin: owlike/genson
@Override
public JsonObject readObject() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_OBJECT == evt) {
return read(builderFactory.createObjectBuilder()).build();
} else throw new JsonException("Expected " + START_OBJECT + " but got " + evt);
}
throw new JsonException("Empty stream");
}
代码示例来源:origin: com.owlike/genson
@Override
public JsonObject readObject() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_OBJECT == evt) {
return read(builderFactory.createObjectBuilder()).build();
} else throw new JsonException("Expected " + START_OBJECT + " but got " + evt);
}
throw new JsonException("Empty stream");
}
代码示例来源:origin: com.owlike/genson
@Override
public JsonStructure read() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_OBJECT == evt) {
return read(builderFactory.createObjectBuilder()).build();
} else if (START_ARRAY == evt) {
return read(builderFactory.createArrayBuilder()).build();
} else throw new JsonException("Expected START_OBJECT or START_ARRAY but got " + evt);
}
throw new JsonException("Empty stream");
}
代码示例来源:origin: owlike/genson
@Override
public JsonStructure read() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_OBJECT == evt) {
return read(builderFactory.createObjectBuilder()).build();
} else if (START_ARRAY == evt) {
return read(builderFactory.createArrayBuilder()).build();
} else throw new JsonException("Expected START_OBJECT or START_ARRAY but got " + evt);
}
throw new JsonException("Empty stream");
}
代码示例来源:origin: owlike/genson
@Override
public JsonArray readArray() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_ARRAY == evt) {
return read(builderFactory.createArrayBuilder()).build();
} else throw new JsonException("Expected " + START_ARRAY + " but got " + evt);
}
throw new JsonException("Empty stream");
}
代码示例来源:origin: com.owlike/genson
@Override
public JsonArray readArray() {
checkNotReadedAndRead();
if (parser.hasNext()) {
Event evt = parser.next();
if (START_ARRAY == evt) {
return read(builderFactory.createArrayBuilder()).build();
} else throw new JsonException("Expected " + START_ARRAY + " but got " + evt);
}
throw new JsonException("Empty stream");
}
内容来源于网络,如有侵权,请联系作者删除!