Write the array in the geojson

@param jsonGenerator
@param array
@throw IOException
14616
private void writeArray(JsonGenerator jsonGenerator, Object[] array, boolean firstInHierarchy) throws IOException, SQLException {
        if(!firstInHierarchy) {
            jsonGenerator.writeStartArray();
        }
        for(int i = 0; i < array.length; i++) {
            if (array[i] instanceof Integer) {
                jsonGenerator.writeNumber((int) array[i]);
            } else if (array[i] instanceof String) {
                if (array[i].equals("{}")) {
                    jsonGenerator.writeStartObject();
                    jsonGenerator.writeEndObject();
                } else {
                    jsonGenerator.writeString((String) array[i]);
                }
            } else if (array[i] instanceof Double) {
                jsonGenerator.writeNumber((double) array[i]);
            } else if (array[i] instanceof Boolean) {
                jsonGenerator.writeBoolean((boolean) array[i]);
            } else if (array[i] instanceof Object[]) {
                writeArray(jsonGenerator, (Object[]) array[i], false);
            }
        }
        if(!firstInHierarchy) {
            jsonGenerator.writeEndArray();
        }
    }
579674
@Override
    protected void write(JsonGenerator g, JacksonJrsTreeCodec codec) throws IOException
    {
        g.writeStartObject();
        if (!_values.isEmpty()) {
            for (Map.Entry<String,JrsValue> entry : _values.entrySet()) {
                g.writeFieldName(entry.getKey());
                codec.writeTree(g, entry.getValue());
            }
        }
        g.writeEndObject();
    }
693362
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    int totalSessionsToCtx = 0, totalDeletedSessions = 0;
    for (int i = 0; i < numNotifierThreads; i++) {
      totalSessionsToCtx += notifierThreads[i].sessionsToCtx.size();
      totalDeletedSessions += notifierThreads[i].deletedSessions.size();
    }

    jsonGenerator.writeNumberField("totalSessionsToCtx",
                                    totalSessionsToCtx);

    jsonGenerator.writeFieldName("sessionsToCtx");
    jsonGenerator.writeStartObject();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (ConcurrentMap.Entry<String, SessionNotificationCtx> entry :
        notifierThreads[i].sessionsToCtx.entrySet()) {
        jsonGenerator.writeFieldName(entry.getKey());
        entry.getValue().write(jsonGenerator);
      }
    }
    jsonGenerator.writeEndObject();

    jsonGenerator.writeNumberField("totalDeletedSessions",
                                    totalDeletedSessions);

    jsonGenerator.writeFieldName("deletedSessions");
    jsonGenerator.writeStartArray();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (String deletedSessionHandle :
            notifierThreads[i].deletedSessions.keySet()) {
        jsonGenerator.writeString(deletedSessionHandle);
      }
    }
    jsonGenerator.writeEndArray();

    jsonGenerator.writeEndObject();
  }
249700
public static void writeGeoJson(Connection connection, String fileName, String tableReference, String encoding) throws IOException, SQLException {
            JsonDriverFunction jsonDriver = new JsonDriverFunction();
            jsonDriver.exportTable(connection,tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(),encoding);
    }
846601
private void writeJsonArray(String arrayName, List<String> values)
            throws JsonGenerationException, IOException {
        writeJsonArrayStart(arrayName);
        for (String value : values)
            generator.writeString(value);
        writeJsonArrayEnd();
    }
398461
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();
    }
89416
@SuppressWarnings("deprecation")
  public static void writeFlowDetails(JsonGenerator jsonGenerator, Flow aFlow,
      DetailLevel selectedSerialization, Predicate<String> includeFilter)
      throws JsonGenerationException, IOException {
    jsonGenerator.writeStartObject();
    // serialize the FlowKey object
    filteredWrite("flowKey", includeFilter, aFlow.getFlowKey(), jsonGenerator);

    // serialize individual members of this class
    filteredWrite("flowName", includeFilter, aFlow.getFlowName(), jsonGenerator);
    filteredWrite("userName", includeFilter, aFlow.getUserName(), jsonGenerator);
    filteredWrite("jobCount", includeFilter, aFlow.getJobCount(), jsonGenerator);
    filteredWrite("totalMaps", includeFilter, aFlow.getTotalMaps(), jsonGenerator);
    filteredWrite("totalReduces", includeFilter, aFlow.getTotalReduces(), jsonGenerator);
    filteredWrite("mapFileBytesRead", includeFilter, aFlow.getMapFileBytesRead(), jsonGenerator);
    filteredWrite("mapFileBytesWritten", includeFilter, aFlow.getMapFileBytesWritten(), jsonGenerator);
    filteredWrite("reduceFileBytesRead", includeFilter, aFlow.getReduceFileBytesRead(), jsonGenerator);
    filteredWrite("hdfsBytesRead", includeFilter, aFlow.getHdfsBytesRead(), jsonGenerator);
    filteredWrite("hdfsBytesWritten", includeFilter, aFlow.getHdfsBytesWritten(), jsonGenerator);
    filteredWrite("mapSlotMillis", includeFilter, aFlow.getMapSlotMillis(), jsonGenerator);
    filteredWrite("reduceSlotMillis", includeFilter, aFlow.getReduceSlotMillis(), jsonGenerator);
    filteredWrite("megabyteMillis", includeFilter, aFlow.getMegabyteMillis(), jsonGenerator);
    filteredWrite("cost", includeFilter, aFlow.getCost(), jsonGenerator);
    filteredWrite("reduceShuffleBytes", includeFilter, aFlow.getReduceShuffleBytes(), jsonGenerator);
    filteredWrite("duration", includeFilter, aFlow.getDuration(), jsonGenerator);
    filteredWrite("wallClockTime", includeFilter, aFlow.getWallClockTime(), jsonGenerator);
    filteredWrite("cluster", includeFilter, aFlow.getCluster(), jsonGenerator);
    filteredWrite("appId", includeFilter, aFlow.getAppId(), jsonGenerator);
    filteredWrite("runId", includeFilter, aFlow.getRunId(), jsonGenerator);
    filteredWrite("version", includeFilter, aFlow.getVersion(), jsonGenerator);
    filteredWrite("hadoopVersion", includeFilter, aFlow.getHadoopVersion(), jsonGenerator);
    if (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING) {
      filteredWrite("submitTime", includeFilter, aFlow.getSubmitTime(), jsonGenerator);
      filteredWrite("launchTime", includeFilter, aFlow.getLaunchTime(), jsonGenerator);
      filteredWrite("finishTime", includeFilter, aFlow.getFinishTime(), jsonGenerator);
    }
    filteredWrite(Constants.HRAVEN_QUEUE, includeFilter, aFlow.getQueue(), jsonGenerator);
    filteredWrite("counters", includeFilter, aFlow.getCounters(), jsonGenerator);
    filteredWrite("mapCounters", includeFilter, aFlow.getMapCounters(), jsonGenerator);
    filteredWrite("reduceCounters", includeFilter, aFlow.getReduceCounters(), jsonGenerator);

    // if flag, include job details
    if ((selectedSerialization == SerializationContext.DetailLevel.FLOW_SUMMARY_STATS_WITH_JOB_STATS)
        || (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING)) {
      jsonGenerator.writeFieldName("jobs");
      jsonGenerator.writeObject(aFlow.getJobs());
    }
    jsonGenerator.writeEndObject();

  }
851433
public static void tagToJson(JsonGenerator gen, Tag tag) throws IOException {
    final String key = tag.getKey();
    if (RELAXED_GROUP_KEYS.contains(key)) {
      gen.writeStringField(key, toValidCharsetTable(CHARS_ALLOWED_GROUPS, tag.getValue()));
    } else {
      gen.writeStringField(toValidCharset(tag.getKey()), toValidCharset(tag.getValue()));
    }
  }
6837
public void serialize(Map<String, T> map, JsonGenerator jsonGenerator) throws IOException {
        jsonGenerator.writeStartObject();
        for (Map.Entry<String, T> entry : map.entrySet()) {
            jsonGenerator.writeFieldName(entry.getKey());
            if (entry.getValue() == null) {
                jsonGenerator.writeNull();
            } else {
                serialize(entry.getValue(), jsonGenerator, true);
            }
        }
        jsonGenerator.writeEndObject();
    }
912269
public void write() throws IOException {
		{
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + postfix;
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeGen(fileObject, jsonModel);
		}
		if (jsonModel.isBuilder()) {
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + "JsonMeta";
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeJsonMeta(fileObject, jsonModel);
		}
	}
674412
@Override
    public void writeTree(JsonGenerator g, TreeNode tree) throws IOException {
        if (_treeCodec == null) {
            _noTreeCodec("write TreeNode");
        }
        _treeCodec.writeTree(g, tree);
    }
1292982
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    jsonGenerator.writeStringField("handle", handle);

    jsonGenerator.writeStringField("host", host);

    jsonGenerator.writeNumberField("port", port);

    jsonGenerator.writeNumberField("numPendingCalls", pendingCalls.size());

    jsonGenerator.writeFieldName("pendingCalls");
    jsonGenerator.writeStartArray();
    for (TBase call : pendingCalls) {
      jsonGenerator.writeStartObject();

      // TBase is an abstract class. While reading back, we want to know
      // what kind of object we actually wrote. Jackson does provide two methods
      // to do it automatically, but one of them adds types at a lot of places
      // where we don't need it, and hence our parsing would be required to be
      // changed. The other required adding an annotation to the TBase class,
      // which we can't do, since it is auto-generated by Thrift.
      String callType = call.getClass().getName();
      jsonGenerator.writeStringField("callType", callType);

      jsonGenerator.writeObjectField("call", call);

      jsonGenerator.writeEndObject();
    }
    jsonGenerator.writeEndArray();

    jsonGenerator.writeEndObject();
  }
809187
private void writeArray(SerIterator itemIterator) throws IOException {
        output.writeArrayStart();
        while (itemIterator.hasNext()) {
            itemIterator.next();
            output.writeArrayItemStart();
            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
        }
        output.writeArrayEnd();
    }
950144
private static void arrayToWriter(Object array, JsonWriter writer) throws IOException {
    writer.beginArray();
    for (int i = 0, size = Array.getLength(array); i < size; i++) {
      writeValue(Array.get(array, i), writer);
    }
    writer.endArray();
  }
588085
private void writeActions(List<Action> actions)
            throws JsonGenerationException, IOException {
        List<String> actionStrings = new ArrayList<String>();

        for (Action action : actions) {
            actionStrings.add(action.getActionName());
        }
        writeJsonArray(JsonDocumentFields.ACTION, actionStrings);
    }
937802
private void writeGeometry(Geometry geom, JsonGenerator gen) throws IOException {       
        if (geom != null) {
            gen.writeObjectFieldStart("geometry");
            if (geom instanceof Point) {
                write((Point) geom, gen);
            } else if (geom instanceof MultiPoint) {
                write((MultiPoint) geom, gen);
            } else if (geom instanceof LineString) {
                write((LineString) geom, gen);
            } else if (geom instanceof MultiLineString) {
                write((MultiLineString) geom, gen);
            } else if (geom instanceof Polygon) {
                write((Polygon) geom, gen);
            } else if (geom instanceof MultiPolygon) {
                write((MultiPolygon) geom, gen);
            } else if (geom instanceof GeometryCollection) {
                write((GeometryCollection) geom, gen);
            } else {
                throw new RuntimeException("Unsupported Geomery type");
            }
            gen.writeEndObject();
        } else {
            gen.writeNullField("geometry");
        }
        
    }
597121
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    jsonGenerator.writeFieldName("idToRequest");
    jsonGenerator.writeStartObject();
    for (Integer id : idToRequest.keySet()) {
      jsonGenerator.writeFieldName(id.toString());
      idToRequest.get(id).write(jsonGenerator);
    }
    jsonGenerator.writeEndObject();

    // idToPendingRequests is the same, and we only need to persist the
    // array of pending request ids
    jsonGenerator.writeFieldName("idToPendingRequests");
    jsonGenerator.writeStartArray();
    for (Integer id : idToPendingRequests.keySet()) {
      jsonGenerator.writeNumber(id);
    }
    jsonGenerator.writeEndArray();

    jsonGenerator.writeFieldName("idToGrant");
    jsonGenerator.writeStartObject();
    for (Integer id : idToGrant.keySet()) {
      jsonGenerator.writeObjectField(id.toString(), idToGrant.get(id));
    }
    jsonGenerator.writeEndObject();

    jsonGenerator.writeObjectField("status", status);

    jsonGenerator.writeStringField("sessionId", sessionId);

    jsonGenerator.writeBooleanField("deleted", deleted);

    jsonGenerator.writeNumberField("deletedTime", deletedTime);

    jsonGenerator.writeObjectField("info", info);
    
    jsonGenerator.writeNumberField("startTime", startTime);

    jsonGenerator.writeFieldName("poolInfo");
    poolInfo.write(jsonGenerator);

    jsonGenerator.writeFieldName("typeToFirstWait");
    jsonGenerator.writeStartObject();
    for (ResourceType resourceType : typeToFirstWait.keySet()) {
      Long wait = typeToFirstWait.get(resourceType);
      if (wait == null) {
        wait = new Long(-1);
      }
      jsonGenerator.writeNumberField(resourceType.toString(), wait);
    }
    jsonGenerator.writeEndObject();

    jsonGenerator.writeObjectField("expectedInfo", expectedInfo);
    
    jsonGenerator.writeObjectField("lastHeartbeat", lastHeartbeat);
    
    jsonGenerator.writeNumberField("lastSyncTime", lastSyncTime);

    jsonGenerator.writeEndObject();
    // No need to serialize lastHeartbeatTime, it will be reset.
    // typeToContext can be rebuilt
  }