Пример #1
0
 private ServiceBox<StatDto> createStatBox(ServiceBox.Type type) {
   List<StatDto> sts = new ArrayList<StatDto>();
   for (int i = 0; jsonReader.next(); i++) {
     StatDto s = decodeStatistics(i);
     sts.add(s);
   }
   return new ServiceBox<StatDto>(type, sts);
 }
Пример #2
0
 private ServiceBox<Snapshot> createSnapshotBox(ServiceBox.Type type) {
   List<Snapshot> snapshots = new ArrayList<Snapshot>();
   while (jsonReader.next()) {
     Snapshot sn = decodeSnapshot();
     snapshots.add(sn);
   }
   return new ServiceBox<Snapshot>(type, snapshots);
 }
Пример #3
0
 private ServiceBox<String> createStringBox(ServiceBox.Type type) {
   List<String> list = new ArrayList<String>();
   while (jsonReader.next()) {
     int len = jsonReader.stringLength();
     list.add(charBuffer.subSequence(0, len).toString());
     charBuffer.position(charBuffer.position() + len);
   }
   return new ServiceBox<String>(type, list);
 }
Пример #4
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;
 }
Пример #5
0
 private TimeHolder[] decodeTimeHolders() {
   ArrayList<TimeHolder> list = new ArrayList<TimeHolder>();
   while (jsonReader.next()) {
     long min = jsonReader.readDecimal(FIELD.min.name()).getUnscaled();
     long max = jsonReader.readDecimal(FIELD.max.name()).getUnscaled();
     long accum = jsonReader.readDecimal(FIELD.accum.name()).getUnscaled();
     int[] hist = decodeHistogram();
     TimeHolder holder = new TimeHolder(min, max, accum, hist);
     list.add(holder);
   }
   TimeHolder[] holders = list.toArray(new TimeHolder[] {});
   return holders;
 }