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); }
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); }
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); }
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; }
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; }