Example usage for com.fasterxml.jackson.core JsonGenerator writeRaw

List of usage examples for com.fasterxml.jackson.core JsonGenerator writeRaw

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonGenerator writeRaw.

Prototype

public void writeRaw(SerializableString raw) throws IOException, JsonGenerationException 

Source Link

Document

Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such).

Usage

From source file:org.datagator.utils.json.StandardPrinter.java

@Override
public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException, JsonGenerationException {
    jg.writeRaw(": ");
}

From source file:org.datagator.utils.json.StandardPrinter.java

@Override
public void writeStartArray(JsonGenerator jg) throws IOException, JsonGenerationException {
    jg.writeRaw("[");
}

From source file:org.datagator.utils.json.StandardPrinter.java

@Override
public void writeArrayValueSeparator(JsonGenerator jg) throws IOException, JsonGenerationException {
    jg.writeRaw(", ");
}

From source file:org.datagator.utils.json.StandardPrinter.java

@Override
public void writeEndArray(JsonGenerator jg, int nrOfValues) throws IOException, JsonGenerationException {
    jg.writeRaw("]");
}

From source file:org.datagator.utils.json.StandardPrinter.java

@Override
public void writeEndObject(JsonGenerator jg, int nrOfEntries) throws IOException, JsonGenerationException {
    jg.writeRaw("}");
}

From source file:org.linkedin.util.json.jackson.LfNSpacesIndenter.java

@Override
public void writeIndentation(JsonGenerator jg, int level) throws IOException {
    jg.writeRaw(SYSTEM_LINE_SEPARATOR);
    // N spaces per level
    int numSpaces;
    // faster to add than multiply...
    switch (_numSpaces) {
    case 1:/*from   ww w  .j a  va  2  s  .c  om*/
        numSpaces = level;
        break;

    case 2:
        numSpaces = level + level;
        break;

    case 3:
        numSpaces = level + level + level;
        break;

    case 4:
        numSpaces = level + level + level + level;
        break;

    default:
        numSpaces = level * _numSpaces;
        break;
    }

    while (numSpaces > SPACE_COUNT) { // should never happen but...
        jg.writeRaw(SPACES, 0, SPACE_COUNT);
        numSpaces -= SPACES.length;
    }
    jg.writeRaw(SPACES, 0, numSpaces);
}

From source file:org.linkedin.util.json.jackson.JacksonPrettyPrinter.java

@Override
public void writeEndArray(JsonGenerator jg, int nrOfValues) throws IOException {
    _nesting--;/*from   ww  w .  j av  a2  s.  c  o  m*/
    writeIndentation(jg);
    jg.writeRaw(']');
}

From source file:org.linkedin.util.json.jackson.JacksonPrettyPrinter.java

@Override
public void writeEndObject(JsonGenerator jg, int nrOfEntries) throws IOException {
    _nesting--;/*from  w  w  w.ja v a2 s . c om*/
    writeIndentation(jg);
    jg.writeRaw('}');
}

From source file:org.enotron.simulator.utility.JsonByteArrayToHexString.java

@Override
public void serialize(byte[] byteArray, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonProcessingException {

    String hexString = ByteArrayHelper.toHexString(byteArray);
    jgen.writeRaw(hexString);
}

From source file:net.opentsdb.contrib.tsquare.web.view.AbstractJsonResponseWriter.java

@Override
public void endResponse(final ResponseContext context) throws IOException {
    final JsonGenerator jsonGenerator = getJsonGenerator(context);

    if (context.getProperty("isJsonpResponse", Boolean.FALSE, Boolean.class)) {
        jsonGenerator.writeRaw(')'); // END of jsonp response wrapper.
    }/*from   w w  w . j  a  v  a  2  s . c o m*/
}