Exemple #1
0
 public String constructJsonString() {
   String str = "";
   Json json = new Json();
   json.setOutputType(OutputType.json);
   str = json.toJson(this);
   json.prettyPrint(str);
   return str;
 }
  @Override
  public void saveStatistics(es.danirod.rectball.model.Statistics statistics) {
    Json json = new Json();
    json.setOutputType(JsonWriter.OutputType.json);
    String jsonData = json.toJson(statistics);

    // Encode statistics in Base64 and save it to a file.
    String encodedJson = Base64Coder.encodeString(jsonData);
    FileHandle handle;
    handle = getStatistics();
    handle.writeString(encodedJson, false);
  }