Writes a string to a character stream.
If {@code value} is null, write a null string ("").

@param value the string to write to a character-output stream
@return this JsonWriter
@throws IOException if an I/O error has occurred
197061
public JsonWriter writeValue(String value) throws IOException {
        if (!willWriteValue) {
            indent();
        }
        writer.write(escape(value));
        willWriteValue = false;
        return this;
    }
262547
public JSONEmitter addValue(String value) {
        checkComma();
        write('"');
        write(encodeString(value));
        write('"');
        return this;
    }
937603
@Override
  public void write(JsonWriterImpl out, byte []value)
  {
    StringBuilder sb = new StringBuilder();

    Base64Util.encode(sb, value, 0, value.length);

    out.write(sb.toString());
  }
591620
private void writeValue(Object value) throws JSONException {
        if (value instanceof Number) {
            String string = JSONObject.numberToString((Number) value);
            int integer = this.valuekeep.find(string);
            if (integer != none) {
                write(2, 2);
                write(integer, this.valuekeep);
                return;
            }
            if (value instanceof Integer || value instanceof Long) {
                long longer = ((Number) value).longValue();
                if (longer >= 0 && longer < int14) {
                    write(0, 2);
                    if (longer < int4) {
                        zero();
                        write((int) longer, 4);
                        return;
                    }
                    one();
                    if (longer < int7) {
                        zero();
                        write((int)(longer - int4), 7);
                        return;
                    }
                    one();
                    write((int)(longer - int7), 14);
                    return;
                }
            }
            write(1, 2);
            for (int i = 0; i < string.length(); i += 1) {
                write(bcd(string.charAt(i)), 4);
            }
            write(endOfNumber, 4);
            this.valuekeep.register(string);
        } else {
            write(3, 2);
            writeJSON(value);
        }
    }
1357133
public JsonWriter value(@NonNull Iterator<?> value) throws IOException {
      Preconditions.checkArgument(inArray() || writeStack.peek() == JsonTokenType.NAME,
                                  "Expecting an array or a name, but found " + writeStack.peek());
      popIf(JsonTokenType.NAME);
      return value(Collect.asIterable(value));
   }
305142
public <T extends Object> void writeValue(T value) throws IOException {
        writeValue(value, (Class<T>) value.getClass());
    }
560759
public JBBPTextWriter Short(final String value) throws IOException {
    for (int i = 0; i < value.length(); i++) {
      this.Short(value.charAt(i));
    }
    return this;
  }
245149
public void writeChar(char value) throws UnsupportedEncodingException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "writeChar", Character.valueOf(value));
    getBodyList().add(Character.valueOf(value));
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "writeChar");
  }
28966
protected static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent, JSONConfig config) throws JSONException, IOException {
		if (value == null || value instanceof JSONNull) {
			writer.write(JSONNull.NULL.toString());
		} else if (value instanceof JSON) {
			((JSON) value).write(writer, indentFactor, indent);
		} else if (value instanceof Map) {
			new JSONObject((Map<?, ?>) value).write(writer, indentFactor, indent);
		} else if (value instanceof Iterable || value instanceof Iterator || value.getClass().isArray()) {
			new JSONArray(value).write(writer, indentFactor, indent);
		} else if (value instanceof Number) {
			writer.write(NumberUtil.toStr((Number) value));
		} else if (value instanceof Date || value instanceof Calendar) {
			final String format = (null == config) ? null : config.getDateFormat();
			writer.write(formatDate(value, format));
		} else if (value instanceof Boolean) {
			writer.write(value.toString());
		} else if (value instanceof JSONString) {
			Object o;
			try {
				o = ((JSONString) value).toJSONString();
			} catch (Exception e) {
				throw new JSONException(e);
			}
			writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
		} else {
			JSONUtil.quote(value.toString(), writer);
		}
		return writer;
	}
1020049
public PactDslJsonArray stringValue(String value) {
      if (value == null) {
        body.put(JSONObject.NULL);
      } else {
        body.put(value);
      }
      return this;
    }
1143661
public JsonWriter valueLiteral(CharSequence value) {
        startValue();

        if (value == null) {
            writer.write(kNull);
        } else {
            writer.write(value.toString());
        }
        return this;
    }
1162724
public void writeValue (String name, Object value) {
		try {
			writer.name(name);
		} catch (IOException ex) {
			throw new JsonException(ex);
		}
		if (value == null)
			writeValue(value, null, null);
		else
			writeValue(value, value.getClass(), null);
	}
1065742
public JsonWriter value(CharSequence value) {
        startValue();

        if (value == null) {
            writer.write(kNull);
        } else {
            writeQuotedAndEscaped(value);
        }
        return this;
    }
1089457
public static String toJsonString(Object value) {
        if (value == null) {
            return "null";
        }
        else if (value.getClass().equals(String.class)) {
            return "\"" + StringUtils.jsonEncoding(value.toString()) + "\"";
        }
        // else it's a RawJson, Boolean or Number so no escaping or quotes
        else {
            return value.toString();
        }
    }
756459
public Serializer writeString(String value) throws IOException {
        if (null == value) return writeNull();

        writer.write('"');

        char[] chars = value.toCharArray();

        for (int i=0; i<chars.length; i++)
        {
            char c = chars[i];
            switch (c)
            {
                case  '"': writer.write("\\\""); break;
                case '\\': writer.write("\\\\"); break;
                case    0: writer.write("\\u0000"); break;
                case '\b': writer.write("\\b"); break;
                case '\t': writer.write("\\t"); break;
                case '\n': writer.write("\\n"); break;
                case '\f': writer.write("\\f"); break;
                case '\r': writer.write("\\r"); break;
                case '/': writer.write("\\/"); break;
                default:
                    if ((c >= 32) && (c <= 126))
                    {
                        writer.write(c);
                    }
                    else
                    {
                        writer.write("\\u");
                        writer.write(rightAlignedZero(Integer.toHexString(c),4));
                    }
            }
        }

        writer.write('"');

        return this;
    }
689205
@NonNull public CMARichText setValue(@NonNull CharSequence value) {
    if (value == null) {
      throw new NullPointerException("value is null.");
    }
    this.value = value;
    return this;
  }
775518
public void write(int value, BitWriter bitwriter) throws JSONException {
        this.width = 0;
        write(this.symbols[value], bitwriter);
        tick(value);
        if (JSONzip.probe) {
            JSONzip.logchar(value, this.width);
        }
    }