/** * Write a field whose value is a map with string keys and values. * * The field will be written if required is true or the map value is non-empty. * * @param fieldName is the name of the field. * @param value of the field. * @param required indicates whether this field will always be written * @throws IOException if there is an error writing. */ public void writeMapField(String fieldName, Map<String, ?> value, boolean required) throws IOException { if (required || value.isEmpty() == false) { writeFieldName(fieldName); writeMap(value); } }