示例#1
0
 private Snapshot decodeSnapshot() {
   long execCount = jsonReader.readDecimal(FIELD.count.name()).getUnscaled();
   long firstTime = jsonReader.readDecimal(FIELD.first.name()).getUnscaled();
   long lastTime = jsonReader.readDecimal(FIELD.last.name()).getUnscaled();
   jsonReader.findField(FIELD.exec.name());
   TimeHolder[] timeHolders = decodeTimeHolders();
   return new SnapshotImpl(firstTime, lastTime, execCount, timeHolders);
 }
示例#2
0
 private int[] decodeHistogram() {
   jsonReader.findField(FIELD.hist.name());
   ArrayList<Integer> list = new ArrayList<Integer>();
   while (jsonReader.next()) {
     list.add((int) jsonReader.readDecimal().getUnscaled());
   }
   int[] hist = new int[list.size()];
   for (int i = 0; i < list.size(); i++) {
     hist[i] = list.get(i);
   }
   return hist;
 }
示例#3
0
  public ServiceBox decodeBox(String s) {
    ServiceBox box = null;
    charBuffer.clear();
    charBuffer.put(s);
    charBuffer.flip();
    // String typeString = s.replaceAll("\\\":.*$", "").replaceAll("^.*\\\"", "");
    int typeLength = jsonReader.stringLength(FIELD.type.name());
    if (typeLength < 1) {
      log.err("Data type undefined " + s);
      return null;
    }
    String typeString = charBuffer.subSequence(0, typeLength).toString();

    TYPE type = TYPE.valueOf(typeString);
    int statusCode = 0;
    if (type == TYPE.status) {
      statusCode = (int) jsonReader.readDecimal(FIELD.data.name()).getUnscaled();
    } else {
      jsonReader.findField(FIELD.data.name());
    }
    ServiceBox.Type boxType;
    switch (type) {
      case pList:
      case mList:
      case rList:
        box = createStatBox(ServiceBox.Type.REG);
        break;
      case descData:
        box = createStringBox(ServiceBox.Type.DESC);
        break;
      case status:
        box = createStringBox(statusCode);
        break;
      case statData:
        box = createSnapshotBox(ServiceBox.Type.STAT);
        break;
      case cfgData:
        box = createStringBox(ServiceBox.Type.CFG);
        break;
    }
    return box;
  }