• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2013 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 package org.webrtc;
12 
13 /** Java version of webrtc::StatsReport. */
14 public class StatsReport {
15   /** Java version of webrtc::StatsReport::Value. */
16   public static class Value {
17     public final String name;
18     public final String value;
19 
20     @CalledByNative("Value")
Value(String name, String value)21     public Value(String name, String value) {
22       this.name = name;
23       this.value = value;
24     }
25 
26     @Override
toString()27     public String toString() {
28       StringBuilder builder = new StringBuilder();
29       builder.append("[").append(name).append(": ").append(value).append("]");
30       return builder.toString();
31     }
32   }
33 
34   public final String id;
35   public final String type;
36   // Time since 1970-01-01T00:00:00Z in milliseconds.
37   public final double timestamp;
38   public final Value[] values;
39 
40   @CalledByNative
StatsReport(String id, String type, double timestamp, Value[] values)41   public StatsReport(String id, String type, double timestamp, Value[] values) {
42     this.id = id;
43     this.type = type;
44     this.timestamp = timestamp;
45     this.values = values;
46   }
47 
48   @Override
toString()49   public String toString() {
50     StringBuilder builder = new StringBuilder();
51     builder.append("id: ")
52         .append(id)
53         .append(", type: ")
54         .append(type)
55         .append(", timestamp: ")
56         .append(timestamp)
57         .append(", values: ");
58     for (int i = 0; i < values.length; ++i) {
59       builder.append(values[i].toString()).append(", ");
60     }
61     return builder.toString();
62   }
63 }
64