class OpentsdbMetricReader extends AbstractReader<RawMetric, Metric> {

    @Override
    public Stream<Metric> read(RawMetric rawMetric) {
        String bodyStr = readUTF8(rawMetric.getRawBody());

        // 上传的可能是一个数组
        if (bodyStr.charAt(0) == ARRAY_START) {
            JSONArray array = JSON.parseArray(bodyStr);
            return array.stream()
                    .map(o -> OpentsdbConverter.convertToModel((JSONObject) o));
        } else {
            return Stream.of(OpentsdbConverter.convertToModel(JSON.parseObject(bodyStr)));
        }
    }

}