List of usage examples for com.fasterxml.jackson.core JsonGenerator close
@Override public abstract void close() throws IOException;
From source file:net.echinopsii.ariane.community.plugin.rabbitmq.directory.json.RabbitmqNodeJSON.java
public final static void manyRabbitmqNodes2JSON(HashSet<RabbitmqNode> nodes, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = RabbitmqDirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8);/*w ww .ja v a2 s . c o m*/ jgenerator.writeStartObject(); jgenerator.writeArrayFieldStart("rabbitmqnodes"); for (RabbitmqNode node : nodes) rabbitmqNode2JSON(node, jgenerator); jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.plugin.rabbitmq.directory.json.RabbitmqClusterJSON.java
public final static void manyRabbitmqClusters2JSON(HashSet<RabbitmqCluster> clusters, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = RabbitmqDirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8);/*from w w w . j av a 2 s . co m*/ jgenerator.writeStartObject(); jgenerator.writeArrayFieldStart("rabbitmqclusters"); for (RabbitmqCluster cluster : clusters) rabbitmqCluster2JSON(cluster, jgenerator); jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:com.netflix.hystrix.serial.SerialHystrixRequestEvents.java
private static void serializeRequestEvents(HystrixRequestEvents requestEvents, JsonGenerator json) { try {// w w w. j a v a2 s . c om json.writeStartArray(); for (Map.Entry<HystrixRequestEvents.ExecutionSignature, List<Integer>> entry : requestEvents .getExecutionsMappedToLatencies().entrySet()) { convertExecutionToJson(json, entry.getKey(), entry.getValue()); } json.writeEndArray(); json.close(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.organisational.TeamJSON.java
public final static void manyTeams2JSON(HashSet<Team> teams, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from w w w . j a v a 2s. c o m jgenerator.writeArrayFieldStart("teams"); Iterator<Team> iter = teams.iterator(); while (iter.hasNext()) { Team current = iter.next(); TeamJSON.team2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:com.meetingninja.csse.database.NotesDatabaseAdapter.java
private static String getEditPayload(String noteID, String field, String value) throws IOException { ByteArrayOutputStream json = new ByteArrayOutputStream(); // this type of print stream allows us to get a string easily PrintStream ps = new PrintStream(json); // Create a generator to build the JSON string JsonGenerator jgen = JFACTORY.createGenerator(ps, JsonEncoding.UTF8); // Build JSON Object for Title jgen.writeStartObject();// w w w . j av a 2s .c om jgen.writeStringField(Keys.Note.ID, noteID); jgen.writeStringField("field", field); jgen.writeStringField("value", value); jgen.writeEndObject(); jgen.close(); String payload = json.toString("UTF8"); ps.close(); Log.d("updatenotepayload", payload); return payload; }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.system.OSTypeJSON.java
public final static void manyOSTypes2JSON(HashSet<OSType> osTypes, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();/* w w w. ja va2 s .c o m*/ jgenerator.writeArrayFieldStart("osTypes"); Iterator<OSType> iter = osTypes.iterator(); while (iter.hasNext()) { OSType current = iter.next(); OSTypeJSON.osType2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.organisational.CompanyJSON.java
public final static void manyCompanies2JSON(HashSet<Company> companies, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from ww w.j av a 2 s. c o m jgenerator.writeArrayFieldStart("companies"); Iterator<Company> iter = companies.iterator(); while (iter.hasNext()) { Company current = iter.next(); CompanyJSON.company2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.network.SubnetJSON.java
public final static void manySubnets2JSON(HashSet<Subnet> subnets, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();/*from w w w . jav a2 s.c o m*/ jgenerator.writeArrayFieldStart("subnets"); Iterator<Subnet> iter = subnets.iterator(); while (iter.hasNext()) { Subnet current = iter.next(); SubnetJSON.subnet2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:com.meetingninja.csse.database.MeetingDatabaseAdapter.java
private static String getEditPayload(String meetingID, String field, String value) throws IOException { ByteArrayOutputStream json = new ByteArrayOutputStream(); // this type of print stream allows us to get a string easily PrintStream ps = new PrintStream(json); // Create a generator to build the JSON string JsonGenerator jgen = JFACTORY.createGenerator(ps, JsonEncoding.UTF8); // Build JSON Object for Title jgen.writeStartObject();/*from w w w . j a v a 2 s . co m*/ jgen.writeStringField(Keys.Meeting.ID, meetingID); jgen.writeStringField("field", field); jgen.writeStringField("value", value); jgen.writeEndObject(); jgen.close(); String payload = json.toString("UTF8"); ps.close(); return payload; }
From source file:com.meetingninja.csse.database.TaskDatabaseAdapter.java
private static String getEditPayload(String taskID, String field, String value) throws IOException { ByteArrayOutputStream json = new ByteArrayOutputStream(); // this type of print stream allows us to get a string easily PrintStream ps = new PrintStream(json); // Create a generator to build the JSON string JsonGenerator jgen = JFACTORY.createGenerator(ps, JsonEncoding.UTF8); // Build JSON Object for Title jgen.writeStartObject();/* ww w .j a v a 2 s. c om*/ jgen.writeStringField(Keys.Task.ID, taskID); jgen.writeStringField("field", field); jgen.writeStringField("value", value); jgen.writeEndObject(); jgen.close(); String payload = json.toString("UTF8"); ps.close(); return payload; }