122123124125126127128129130131132
writer.value(prin.getName()); // delegate to the service to do the actual export dataService_1_1.exportData(writer); writer.endObject(); // end root writer.close(); } catch (IOException e) { logger.error("Unable to export data", e); }
152153154155156157158159160161162
// do the data export StringWriter stringWriter = new StringWriter(); JsonWriter writer = new JsonWriter(stringWriter); writer.beginObject(); dataService.exportData(writer); writer.endObject(); writer.close(); // parse the output as a JSON object for testing JsonElement elem = new JsonParser().parse(stringWriter.toString()); JsonObject root = elem.getAsJsonObject();
396397398399400401402403404405406
644645646647648649650651652653654
815816817818819820821822823824825
956957958959960961962963964965966
11381139114011411142114311441145114611471148
13821383138413851386138713881389139013911392
15521553155415551556155715581559156015611562
7576777879808182838485
writer.name("name").value(chan.getName()); if(chan.getUser() != null) { writer.name("user").value(chan.getUser()); } writer.name("type").value(chan.getType().ordinal()); writer.endObject(); } } writer.endArray(); writer.close(); } catch (Exception e) {