Write a set of fields from a field container to a JSON file.
@param objectName name of the object, or null if no name required
@param container field container
@param fields fields to write
490742
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
   {
      m_writer.writeStartObject(objectName);
      for (FieldType field : fields)
      {
         Object value = container.getCurrentValue(field);
         if (value != null)
         {
            writeField(field, value);
         }
      }
      m_writer.writeEndObject();
   }
490220
public static void writeObject(Object object, String fileName) throws DISIException {
        log.info("Writing " + fileName);
        try {
            FileOutputStream fos = new FileOutputStream(fileName);
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(object);
            oos.close();
            fos.close();
        } catch (IOException e) {
            final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
            log.error(errMessage, e);
            throw new DISIException(errMessage, e);
        }
    }
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();
    }
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();
  }
739964
public void addFields(GenericField[] fields)
	{
		for (int i=0; i < fields.length;i++)
		{
			this.fieldMap.put(fields[i].getFieldName(), fields[i]);
		}
	}
695949
public void write(JsonWriter json, UserDto user, Collection<String> groups, @Nullable Collection<String> fields) {
    json.beginObject();
    json.prop(FIELD_LOGIN, user.getLogin());
    writeIfNeeded(json, user.getName(), FIELD_NAME, fields);
    if (userSession.isLoggedIn()) {
      writeIfNeeded(json, user.getEmail(), FIELD_EMAIL, fields);
      writeIfNeeded(json, user.isActive(), FIELD_ACTIVE, fields);
      writeIfNeeded(json, user.isLocal(), FIELD_LOCAL, fields);
      writeIfNeeded(json, user.getExternalLogin(), FIELD_EXTERNAL_IDENTITY, fields);
      writeIfNeeded(json, user.getExternalIdentityProvider(), FIELD_EXTERNAL_PROVIDER, fields);
      writeGroupsIfNeeded(json, groups, fields);
      writeScmAccountsIfNeeded(json, fields, user);
    }
    json.endObject();
  }
850624
private void writeObject(final ObjectOutputStream out) throws IOException {
		out.writeObject(mapper.getClass());
		jobConf.write(out);
	}
1037508
public final void addFields(Document document, CellName cellName) {
        String serializedKey = ByteBufferUtils.toString(cellName.toByteBuffer());
        Field field = new StringField(FIELD_NAME, serializedKey, Field.Store.YES);
        document.add(field);
    }
526072
public static void writeJsonProperty(JsonWriter writer, String name,
                                         Object value, MappingRules mapping)
            throws RepositoryException, IOException {
        if (name != null && value != null) {
            int type = PropertyType.STRING;
            if (value instanceof Boolean) {
                type = PropertyType.BOOLEAN;
            } else if (value instanceof Long || value instanceof Integer) {
                type = PropertyType.LONG;
            } else if (value instanceof Double || value instanceof Float) {
                type = PropertyType.DOUBLE;
            } else if (value instanceof BigDecimal) {
                type = PropertyType.DECIMAL;
            } else if (value instanceof Calendar) {
                type = PropertyType.DATE;
            }
            if (mapping.propertyFormat.scope != MappingRules.PropertyFormat.Scope.value) {
                writer.beginObject();
            }
            if (mapping.propertyFormat.scope == MappingRules.PropertyFormat.Scope.value) {
                writer.name(name);
            } else {
                writer.name("name").value(name);
                writer.name("value");
            }
            if (value instanceof Object[]) {
                writer.beginArray();
                for (Object val : (Object[]) value) {
                    JsonUtil.writeJsonValue(writer, null, name, val, type, mapping);
                }
                writer.endArray();
            } else {
                JsonUtil.writeJsonValue(writer, null, name, value, type, mapping);
            }
            if (mapping.propertyFormat.scope != MappingRules.PropertyFormat.Scope.value) {
                writer.name("type").value(PropertyType.nameFromValue(type));
                writer.name("multi").value(value instanceof Object[]);
                writer.endObject();
            }
        }
    }
644992
protected void writeContainerProperties(Map<String, String> properties) throws IOException {

        if (properties.size() > 0) {

            writer.append("[cols=\"2*\", options=\"header\"]").append(NEW_LINE);
            writer.append(".").append(this.resourceBundle.getString("asciidoc.reporter.properties")).append(NEW_LINE);
            writer.append("|===").append(NEW_LINE).append(NEW_LINE);
            writer.append("|KEY").append(NEW_LINE);
            writer.append("|VALUE").append(NEW_LINE).append(NEW_LINE);

            Set<Entry<String, String>> entrySet = properties.entrySet();

            for (Entry<String, String> entry : entrySet) {
                writer.append("|").append(entry.getKey()).append(NEW_LINE);
                writer.append("|").append(entry.getValue()).append(NEW_LINE).append(NEW_LINE);
            }

            writer.append("|===").append(NEW_LINE).append(NEW_LINE);
        }

    }
623686
private void writeStringField(String fieldName, Object value) throws IOException
   {
      String val = value.toString();
      if (!val.isEmpty())
      {
         m_writer.writeNameValuePair(fieldName, val);
      }
   }
1372744
private void writeObject(ObjectOutputStream out) throws IOException {
        PutField fields = out.putFields();
        fields.put(AUTH_METHOD, authMethod);
        fields.put(ACCESS_ID, accessId);
        fields.put(SECURITY_NAME, securityName);
        out.writeFields();
    }
449342
public void writeFields(String[] fields) throws IOException {

		if (newWriter) {
			this.newWriter = false;
		} else {
			this.newLine();
		}
		for (int i = 0; i < fields.length; i++) {
			this.writeField(fields[i]);
		}
	}
902656
public void writeObject (ObjectOutputStream out)
        throws IOException
    {
        int ecount = size();
        out.writeInt(ecount);
        for (Map.Entry<K, V> entry : entrySet()) {
            out.writeObject(entry.getKey());
            out.writeObject(entry.getValue());
        }
    }
1234526
public void setFields(java.util.Collection<Field> fields) {
        if (fields == null) {
            this.fields = null;
            return;
        }

        this.fields = new com.amazonaws.internal.SdkInternalList<Field>(fields);
    }
976680
public static void saveJson(File json, Object object) throws IOException {
        objectMapper.writer().writeValue(json, object);
    }
476792
private static final void writeJson(Writer os, //
                                        Object object, //
                                        SerializeConfig config, //
                                        SerializeFilter[] filters, //
                                        DateFormat dateFormat, //
                                        int defaultFeatures, //
                                        SerializerFeature... features) {
        SerializeWriter writer = new SerializeWriter(os, defaultFeatures, features);

        try {
            JSONSerializer serializer = new JSONSerializer(writer, config);

            if (dateFormat != null) {
                serializer.setDateFormat(dateFormat);
                serializer.config(SerializerFeature.WriteDateUseDateFormat, true);
            }

            if (filters != null) {
                for (SerializeFilter filter : filters) {
                    serializer.addFilter(filter);
                }
            }
            serializer.write(object);
        } finally {
            writer.close();
        }
    }