List of usage examples for com.fasterxml.jackson.core JsonGenerator writeStartArray
public abstract void writeStartArray() throws IOException, JsonGenerationException;
From source file:eu.project.ttc.readers.TermSuiteJsonCasSerializer.java
private static void writeIntFSArrayField(JsonGenerator jg, String fieldName, FSArray words) throws IOException { if (words == null) return;/*from w ww. j a v a 2 s. co m*/ jg.writeArrayFieldStart(fieldName); for (int i = 0; i < words.size(); i++) { WordAnnotation wa = (WordAnnotation) words.get(i); jg.writeStartArray(); jg.writeNumber(wa.getBegin()); jg.writeNumber(wa.getEnd()); jg.writeEndArray(); } jg.writeEndArray(); }
From source file:com.msopentech.odatajclient.engine.data.json.GeospatialJSONHandler.java
private static void serializeLineString(final JsonGenerator jgen, final Element node) throws IOException { for (Element element : XMLUtils.getChildElements(node, ODataConstants.ELEM_POS)) { jgen.writeStartArray(); serializePoint(jgen, element);/* w w w. j a va 2 s . c o m*/ jgen.writeEndArray(); } }
From source file:com.netflix.hystrix.serial.SerialHystrixDashboardData.java
private static void writeDashboardData(JsonGenerator json, HystrixDashboardStream.DashboardData dashboardData) { try {//from w w w . ja v a 2s.co m json.writeStartArray(); for (HystrixCommandMetrics commandMetrics : dashboardData.getCommandMetrics()) { writeCommandMetrics(commandMetrics, json); } for (HystrixThreadPoolMetrics threadPoolMetrics : dashboardData.getThreadPoolMetrics()) { writeThreadPoolMetrics(threadPoolMetrics, json); } for (HystrixCollapserMetrics collapserMetrics : dashboardData.getCollapserMetrics()) { writeCollapserMetrics(collapserMetrics, json); } json.writeEndArray(); json.close(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.msopentech.odatajclient.engine.data.json.GeospatialJSONHandler.java
private static void serializePolygon(final JsonGenerator jgen, final Element node) throws IOException { for (Element exterior : XMLUtils.getChildElements(node, ODataConstants.ELEM_POLYGON_EXTERIOR)) { jgen.writeStartArray(); serializeLineString(jgen,//w w w . ja va2 s. co m XMLUtils.getChildElements(exterior, ODataConstants.ELEM_POLYGON_LINEARRING).get(0)); jgen.writeEndArray(); } for (Element interior : XMLUtils.getChildElements(node, ODataConstants.ELEM_POLYGON_INTERIOR)) { jgen.writeStartArray(); serializeLineString(jgen, XMLUtils.getChildElements(interior, ODataConstants.ELEM_POLYGON_LINEARRING).get(0)); jgen.writeEndArray(); } }
From source file:io.protostuff.JsonIOUtil.java
/** * Serializes the {@code messages} into the generator using the given schema. *//*from w ww .j a v a 2 s . c o m*/ public static <T> void writeListTo(JsonGenerator generator, List<T> messages, Schema<T> schema, boolean numeric) throws IOException { generator.writeStartArray(); if (messages.isEmpty()) { generator.writeEndArray(); return; } final JsonOutput output = new JsonOutput(generator, numeric, schema); for (T m : messages) { generator.writeStartObject(); schema.writeTo(output, m); if (output.isLastRepeated()) generator.writeEndArray(); generator.writeEndObject(); output.reset(); } generator.writeEndArray(); }
From source file:com.tage.calcite.adapter.druid.DruidQuery.java
private static void writeArray(JsonGenerator generator, List<?> elements) throws IOException { generator.writeStartArray(); for (Object o : elements) { writeObject(generator, o);// ww w .j av a2s .c om } generator.writeEndArray(); }
From source file:org.hyperledger.jackson.OutpointSerializer.java
@Override public void serialize(Outpoint value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartArray(); jgen.writeString(value.getTransactionId().toString()); jgen.writeNumber(value.getOutputIndex()); jgen.writeEndArray();//from w ww. ja v a2s .co m }
From source file:com.tellapart.taba.event.EventStringLongPayload.java
@Override public void serialize(JsonGenerator generator) throws JsonGenerationException, IOException { generator.writeStartArray(); generator.writeString(payloadString); generator.writeNumber(payloadLong);//from ww w.j av a2 s. c o m generator.writeEndArray(); }
From source file:org.dbrain.data.jackson.serializers.JsonValueSerializer.java
private void writeList(ValueList value, JsonGenerator w) throws IOException { w.writeStartArray(); try {/*from w w w.j ava 2 s .c o m*/ for (Value e : value) { writeValue(e, w); } } finally { w.writeEndObject(); } }
From source file:com.excilys.ebi.gatling.jenkins.chart.Point.java
public void serialize(JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartArray(); jgen.writeObject(x);/*from w w w .j av a 2 s . c o m*/ jgen.writeObject(y); jgen.writeEndArray(); }