Write a summary to the json document

@param jsonWriter a {@link com.google.gson.stream.JsonWriter}
used to write the json document
343582
protected void writeStateSummary(JsonWriter jsonWriter) throws IOException {
    jsonWriter.name("job name").value(this.getJobName()).name("job id").value(this.getJobId()).name("job state")
        .value(this.getState().name()).name("start time").value(this.getStartTime()).name("end time")
        .value(this.getEndTime()).name("duration").value(this.getDuration()).name("tasks").value(this.getTaskCount())
        .name("completed tasks").value(this.getCompletedTasks());
  }
622955
private void writeJobState(JsonWriter jsonWriter, JobState jobState) throws IOException {
    jobState.toJson(jsonWriter, this.keepConfig);
  }
65101
private void writeJobStates(JsonWriter jsonWriter, List<? extends JobState> jobStates) throws IOException {
    jsonWriter.beginArray();
    for (JobState jobState : jobStates) {
      writeJobState(jsonWriter, jobState);
    }
    jsonWriter.endArray();
  }
503032
public static <T> void writeListTo(Writer writer, List<T> messages, Schema<T> schema,
            boolean numeric) throws IOException
    {
        final JsonGenerator generator = DEFAULT_JSON_FACTORY.createJsonGenerator(writer);
        try
        {
            writeListTo(generator, messages, schema, numeric);
        }
        finally
        {
            generator.close();
        }
    }
646685
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    // nameToNode begins
    jsonGenerator.writeFieldName("nameToNode");
    jsonGenerator.writeStartObject();
    for (Map.Entry<String, ClusterNode> entry : nameToNode.entrySet()) {
      jsonGenerator.writeFieldName(entry.getKey());
      entry.getValue().write(jsonGenerator);
    }
    jsonGenerator.writeEndObject();
    // nameToNode ends

    // hostsToSessions begins
    // We create a new Map of type <ClusterNode.name, Set<SessionIds>>.
    // The original hostsToSessions map has the ClusterNode as its key, and
    // we do not need to persist the entire ClusterNode again, since we have
    // already done that with nameToNode.
    Map<String, Set<String>> hostsToSessionsMap =
      new HashMap<String, Set<String>>();
    for (Map.Entry<ClusterNode, Set<String>> entry :
      hostsToSessions.entrySet()) {
      hostsToSessionsMap.put(entry.getKey().getName(),
        entry.getValue());
    }
    jsonGenerator.writeObjectField("hostsToSessions", hostsToSessionsMap);
    // hostsToSessions ends

    jsonGenerator.writeObjectField("nameToApps", nameToApps);

    // faultManager is not required

    // We can rebuild the loadManager
    jsonGenerator.writeEndObject();
  }
1017981
Writer write(Writer writer, int indentFactor, int indent)
            throws JSONException {
        try {
            boolean commanate = false;
            final int length = this.length();
            Iterator<String> keys = this.keys();
            writer.write('{');

            if (length == 1) {
                Object key = keys.next();
                writer.write(quote(key.toString()));
                writer.write(':');
                if (indentFactor > 0) {
                    writer.write(' ');
                }
                writeValue(writer, this.map.get(key), indentFactor, indent);
            } else if (length != 0) {
                final int newindent = indent + indentFactor;
                while (keys.hasNext()) {
                    Object key = keys.next();
                    if (commanate) {
                        writer.write(',');
                    }
                    if (indentFactor > 0) {
                        writer.write('\n');
                    }
                    indent(writer, newindent);
                    writer.write(quote(key.toString()));
                    writer.write(':');
                    if (indentFactor > 0) {
                        writer.write(' ');
                    }
                    writeValue(writer, this.map.get(key), indentFactor, newindent);
                    commanate = true;
                }
                if (indentFactor > 0) {
                    writer.write('\n');
                }
                indent(writer, indent);
            }
            writer.write('}');
            return writer;
        } catch (IOException exception) {
            throw new JSONException(exception);
        }
    }
756929
public void writeJSON(JSONValue jc, JSONWriter jb, boolean writeClass)
            throws IOException {
        jb.arrayBegin();
        for (Object item : mArray) {
            if (item == null)
                jb.valueNull();
            else
                jc.writeValue(item, jb, writeClass);
        }
        jb.arrayEnd();
    }
1131018
public void writeTo(Writer writer) throws IOException {
        JsonSerializer.write(Json.jObject("template", asJson()), writer);
        writer.flush();
    }
1229014
public void toJson(Map<?, ?> map, Writer writer) throws IOException {
    if (map == null) {
      throw new IllegalArgumentException("map == null");
    }
    if (writer == null) {
      throw new IllegalArgumentException("writer == null");
    }

    JsonWriter jsonWriter = new JsonWriter(writer);
    jsonWriter.setLenient(isLenient);
    if (prettyPrint) {
      jsonWriter.setIndent("  ");
    }
    try {
      mapToWriter(map, jsonWriter);
    } finally {
      jsonWriter.close();
    }
  }
896958
@Override
  public void write(JsonWriterImpl out, T value)
  {
    if (value == null) {
      out.writeNull();
    }
    else if (value.getClass() != Object.class) {
      out.writeObjectValue(value);
    }
  }
535698
public void write(JsonWriter json, @Nullable UserDto user) {
    if (user == null) {
      json.beginObject().endObject();
    } else {
      write(json, user, Collections.emptySet(), CONCISE_FIELDS);
    }
  }
585362
public static void writeJson(Serializable serializable, OutputStream output)
			throws IOException {
		TransportFormat.JSON.writeSerializableTo(serializable, output);
	}
193591
private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        out.writeInt(severity.getOrdinal());
        out.writeObject(summary);
        out.writeObject(detail);
        out.writeObject(rendered);
    }
379347
protected void initJsonWriter() {
		String writerList = config.getJsonWriters();
		if (writerList != null) {
			String[] writers = writerList.split(",");
			Set<String> supportedWriters = TreeWriterRegistry.getWritersByFormat("json");
			TreeWriter selectedWriter = null;
			for (String writer : writers) {
				writer = writer.trim().toLowerCase();
				if (!writer.isEmpty()) {
					for (String supportedWriter : supportedWriters) {
						int i = supportedWriter.lastIndexOf('.');
						if (i > -1) {
							supportedWriter = supportedWriter.substring(i + 1);
						}
						if (supportedWriter.toLowerCase().contains(writer)) {
							selectedWriter = TreeWriterRegistry.getWriter(supportedWriter);
							logger.info("Default JSON serializer/writer is \"" + selectedWriter.getClass() + "\".");
							TreeWriterRegistry.setWriter("json", selectedWriter);
							break;
						}
					}
					if (selectedWriter != null) {
						break;
					}
				}
			}
		}
	}
127732
public void write( SystemInputDef systemInput)
    {
    JsonWriterFactory writerFactory = Json.createWriterFactory( MapBuilder.of( PRETTY_PRINTING, true).build());
    JsonWriter jsonWriter = writerFactory.createWriter( getWriter());

    jsonWriter.write( SystemInputJson.toJson( systemInput));
    }
1228077
void writeObject(java.io.ObjectOutputStream out) throws IOException {
        // when using object serialization, write the json bytes
        byte[] bytes = toString().getBytes(StandardCharsets.UTF_8);
        out.writeInt(bytes.length);
        out.write(bytes);
    }
647631
private void writeObject(JsonGenerator jsonGenerator, Object entity) throws IOException {
        jsonGenerator.writeStartObject();

        writeName(jsonGenerator, entity);
        writeKind(jsonGenerator, entity);
        writeURL(jsonGenerator, entity);

        jsonGenerator.writeEndObject();
    }