Java Code Examples for com.fasterxml.jackson.core.JsonToken#NOT_AVAILABLE
The following examples show how to use
com.fasterxml.jackson.core.JsonToken#NOT_AVAILABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jackson2Tokenizer.java From spring-analysis-note with MIT License | 6 votes |
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; }
Example 2
Source File: Jackson2Tokenizer.java From java-technology-stack with MIT License | 6 votes |
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); }
Example 3
Source File: AbstractJacksonDeserializer.java From servicetalk with Apache License 2.0 | 5 votes |
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; }
Example 4
Source File: DocumentParser.java From ojai with Apache License 2.0 | 4 votes |
@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; }
Example 5
Source File: JrsMissing.java From jackson-jr with Apache License 2.0 | 4 votes |
@Override public JsonToken asToken() { return JsonToken.NOT_AVAILABLE; }