下面列出了com.fasterxml.jackson.core.JsonToken#NOT_AVAILABLE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private List<TokenBuffer> parseTokenBufferFlux() throws IOException {
List<TokenBuffer> result = new ArrayList<>();
while (true) {
JsonToken token = this.parser.nextToken();
// SPR-16151: Smile data format uses null to separate documents
if (token == JsonToken.NOT_AVAILABLE ||
(token == null && (token = this.parser.nextToken()) == null)) {
break;
}
updateDepth(token);
if (!this.tokenizeArrayElements) {
processTokenNormal(token, result);
}
else {
processTokenArray(token, result);
}
}
return result;
}
private Flux<TokenBuffer> parseTokenBufferFlux() throws IOException {
List<TokenBuffer> result = new ArrayList<>();
while (true) {
JsonToken token = this.parser.nextToken();
// SPR-16151: Smile data format uses null to separate documents
if ((token == JsonToken.NOT_AVAILABLE) ||
(token == null && (token = this.parser.nextToken()) == null)) {
break;
}
updateDepth(token);
if (!this.tokenizeArrayElements) {
processTokenNormal(token, result);
}
else {
processTokenArray(token, result);
}
}
return Flux.fromIterable(result);
}
final List<T> consumeParserTokens(@Nullable List<T> resultHolder) throws IOException {
JsonToken token = parser.nextToken();
if (token == JsonToken.NOT_AVAILABLE) {
// Avoid creating list if there are no items available.
return resultHolder == null ? emptyList() : resultHolder;
}
List<T> toReturn = resultHolder == null ? new ArrayList<>(2) : resultHolder;
do {
JsonNode nextRoot = push(token, parser);
if (nextRoot != null) {
toReturn.add(reader.readValue(nextRoot));
}
} while ((token = parser.nextToken()) != JsonToken.NOT_AVAILABLE);
return toReturn;
}
@Override
public JsonToken nextToken() throws IOException, JsonParseException {
if (tokens.isEmpty()
&& (_currEventType = r.next()) != null) {
if (_currEventType != EventType.END_MAP
&& _currEventType != EventType.END_ARRAY) {
if (r.inMap() && r.getFieldName() != null) {
tokens.add(JsonToken.FIELD_NAME);
} else if (!r.inMap()) {
setCurrentArrayIndex();
}
}
switch (_currEventType) {
case START_ARRAY:
containerStack.push(new ContainerContext(Type.ARRAY));
tokens.add(JsonToken.START_ARRAY);
break;
case END_ARRAY:
if (!containerStack.empty()) {
containerStack.pop();
}
tokens.add(JsonToken.END_ARRAY);
break;
case START_MAP:
containerStack.push(new ContainerContext(Type.MAP));
tokens.add(JsonToken.START_OBJECT);
break;
case END_MAP:
if (!containerStack.empty()) {
containerStack.pop();
}
tokens.add(JsonToken.END_OBJECT);
break;
case NULL:
tokens.add(JsonToken.VALUE_NULL);
break;
case STRING:
tokens.add(JsonToken.VALUE_STRING);
break;
case BYTE: case SHORT: case INT: case LONG:
tokens.add(JsonToken.VALUE_NUMBER_INT);
break;
case DECIMAL: case DOUBLE: case FLOAT:
tokens.add(JsonToken.VALUE_NUMBER_FLOAT);
break;
case BOOLEAN:
tokens.add(r.getBoolean() ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE);
break;
case DATE: case TIME: case TIMESTAMP: case INTERVAL: case BINARY:
tokens.add(JsonToken.VALUE_EMBEDDED_OBJECT);
break;
}
}
_currToken = tokens.isEmpty() ? JsonToken.NOT_AVAILABLE : tokens.remove();
return _currToken;
}
@Override
public JsonToken asToken() {
return JsonToken.NOT_AVAILABLE;
}