@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
} else { countStack.push(new S(count, false)); count = input.readMapStart(); if (count < 0) { count = -count;
count = input.readMapStart(); if (count < 0) { count = -count;
case OBJECT: ObjectNode object = JsonNodeFactory.instance.objectNode(); for (long l = in.readMapStart(); l > 0; l = in.mapNext()) for (long i = 0; i < l; i++) object.put(in.readString(), read(in));
@Override void readInternal(Decoder d) throws IOException { Utf8 key = new Utf8(); for (long i = d.readMapStart(); i != 0; i = d.mapNext()) { for (long j = 0; j < i; j++) { key = d.readString(key); d.readFloat(); d.readFloat(); d.readFloat(); d.readFloat(); } } }
case OBJECT: ObjectNode object = JsonNodeFactory.instance.objectNode(); for (long l = in.readMapStart(); l > 0; l = in.mapNext()) for (long i = 0; i < l; i++) object.put(in.readString(), read(in));
} else { level++; counts[level] = vi.readMapStart(); isArray[level] = false; isEmpty[level] = counts[level] == 0;
@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
@Override public long readMapStart() throws IOException { parser.advance(Symbol.MAP_START); long result = in.readMapStart(); if (result == 0) { parser.advance(Symbol.MAP_END); } return result; }
/** * Decodes avro binary response. * @param is input stream to read from * @return Returns decoded map of messages per topic */ private Map<String, Deque<MonitorMessage>> decodeResponse(InputStream is) { Decoder decoder = DecoderFactory.get().directBinaryDecoder(is, null); Map<String, Deque<MonitorMessage>> decodedMessages = new HashMap<>(); try { long entries = decoder.readMapStart(); while (entries > 0) { for (int i = 0; i < entries; i++) { String topicConfig = decoder.readString(); if (topicConfig.isEmpty()) { continue; } decodedMessages.put(topicConfig, decodeMessages(decoder)); } entries = decoder.mapNext(); } } catch (IOException e) { // catch the exception to process all the decoded messages to avoid refetching them. LOG.error("Error while decoding response from Runtime Server. ", e); } return decodedMessages; }
/** * Decodes avro binary response. * @param is input stream to read from * @return Returns decoded map of messages per topic */ private Map<String, Deque<MonitorMessage>> decodeResponse(InputStream is) { Decoder decoder = DecoderFactory.get().directBinaryDecoder(is, null); Map<String, Deque<MonitorMessage>> decodedMessages = new HashMap<>(); try { long entries = decoder.readMapStart(); while (entries > 0) { for (int i = 0; i < entries; i++) { String topicConfig = decoder.readString(); if (topicConfig.isEmpty()) { continue; } decodedMessages.put(topicConfig, decodeMessages(decoder)); } entries = decoder.mapNext(); } } catch (IOException e) { // catch the exception to process all the decoded messages to avoid refetching them. LOG.error("Error while decoding response from Runtime Server. ", e); } return decodedMessages; }
long chunkLength = decoder.readMapStart(); Iterator<Map.Entry<?, ?>> kvIter = lastMap != null ? lastMap.entrySet().iterator() :
@Override public ArrayBasedMapData read(Decoder decoder, Object reuse) throws IOException { reusedKeyList.clear(); reusedValueList.clear(); long chunkLength = decoder.readMapStart(); while (chunkLength > 0) { for (int i = 0; i < chunkLength; i += 1) { reusedKeyList.add(keyReader.read(decoder, null)); reusedValueList.add(valueReader.read(decoder, null)); } chunkLength = decoder.mapNext(); } return new ArrayBasedMapData( new GenericArrayData(reusedKeyList.toArray()), new GenericArrayData(reusedValueList.toArray())); } }
case OBJECT: ObjectNode object = JsonNodeFactory.instance.objectNode(); for (long l = in.readMapStart(); l > 0; l = in.mapNext()) for (long i = 0; i < l; i++) object.put(in.readString(), read(in));
/** Read Json data from Avro data. */ public static JsonNode read(Decoder in) throws IOException { switch (JsonType.values()[in.readIndex()]) { case LONG: return new LongNode(in.readLong()); case DOUBLE: return new DoubleNode(in.readDouble()); case STRING: return new TextNode(in.readString()); case BOOLEAN: return in.readBoolean() ? BooleanNode.TRUE : BooleanNode.FALSE; case NULL: in.readNull(); return NullNode.getInstance(); case ARRAY: ArrayNode array = JsonNodeFactory.instance.arrayNode(); for (long l = in.readArrayStart(); l > 0; l = in.arrayNext()) for (long i = 0; i < l; i++) array.add(read(in)); return array; case OBJECT: ObjectNode object = JsonNodeFactory.instance.objectNode(); for (long l = in.readMapStart(); l > 0; l = in.mapNext()) for (long i = 0; i < l; i++) object.put(in.readString(), read(in)); return object; default: throw new AvroRuntimeException("Unexpected Json node type"); } }