@Override protected final void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } }
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } }
@Override public final void writeStartArray() throws IOException { _writeContext.writeValue(); _append(JsonToken.START_ARRAY); _writeContext = _writeContext.createChildArrayContext(); }
@Override public final void writeStartObject() throws IOException { _writeContext.writeValue(); _append(JsonToken.START_OBJECT); _writeContext = _writeContext.createChildObjectContext(); }
/** * Similar to {@link #_append(JsonToken)} but also updates context with * knowledge that a scalar value was written * * @since 2.6.4 */ protected final void _appendValue(JsonToken type) { _writeContext.writeValue(); Segment next = _hasNativeId ? _last.append(_appendAt, type, _objectId, _typeId) : _last.append(_appendAt, type); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; // since we added first at 0 } }
/** * Similar to {@link #_append(JsonToken,Object)} but also updates context with * knowledge that a scalar value was written * * @since 2.6.4 */ protected final void _appendValue(JsonToken type, Object value) { _writeContext.writeValue(); Segment next = _hasNativeId ? _last.append(_appendAt, type, value, _objectId, _typeId) : _last.append(_appendAt, type, value); if (next == null) { ++_appendAt; } else { _last = next; _appendAt = 1; } }
@Override // since 2.8 public void writeStartObject(Object forValue) throws IOException { _writeContext.writeValue(); _append(JsonToken.START_OBJECT); JsonWriteContext ctxt = _writeContext.createChildObjectContext(); _writeContext = ctxt; if (forValue != null) { ctxt.setCurrentValue(forValue); } }
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException final int status = _writeContext.writeValue(); if (_cfgPrettyPrinter != null) {
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException final int status = _writeContext.writeValue(); if (_cfgPrettyPrinter != null) {
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException final int status = _outputContext.writeValue(); if (_cfgPrettyPrinter != null) {
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException final int status = _outputContext.writeValue(); if (_cfgPrettyPrinter != null) {
@Override public void serialize(String str, JsonGenerator gen, SerializerProvider provider) throws IOException { int status = ((JsonWriteContext) gen.getOutputContext()).writeValue(); switch (status) { case JsonWriteContext.STATUS_OK_AFTER_COLON: gen.writeRaw(':'); break; case JsonWriteContext.STATUS_OK_AFTER_COMMA: gen.writeRaw(','); break; case JsonWriteContext.STATUS_EXPECT_NAME: throw new JsonGenerationException("Can not write string value here", gen); } gen.writeRaw('"'); for (char c : str.toCharArray()) { if (c >= 0x80) writeUnicodeEscape(gen, c); // use generic escaping for all non US-ASCII characters else { // use escape table for first 128 characters int code = (c < ESCAPE_CODES.length ? ESCAPE_CODES[c] : 0); if (code == 0) gen.writeRaw(c); // no escaping else if (code == -1) writeUnicodeEscape(gen, c); // generic escaping else writeShortEscape(gen, (char) code); // short escaping (\n \t ...) } } gen.writeRaw('"'); } });
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } }
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException { int status = _outputContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } }
@Override protected void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not " + typeMsg + ", expecting field name"); } }
@Override protected void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not " + typeMsg + ", expecting field name"); } }
@Override protected void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not " + typeMsg + ", expecting field name"); } }
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException, JsonGenerationException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } if (_handleFirstLine) { _handleFirstLine(); } }
@Override public final void writeStartObject() throws IOException { _writeContext.writeValue(); _append(JsonToken.START_OBJECT); _writeContext = _writeContext.createChildObjectContext(); }
@Override protected final void _verifyValueWrite(String typeMsg) throws IOException { int status = _writeContext.writeValue(); if (status == JsonWriteContext.STATUS_EXPECT_NAME) { _reportError("Can not "+typeMsg+", expecting field name"); } if (_handleFirstLine) { _handleFirstLine(); } }