Java Code Examples for com.dslplatform.json.JsonWriter#writeAscii()

The following examples show how to use com.dslplatform.json.JsonWriter#writeAscii() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetricRegistrySerializer.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
private static void serializeValueStart(String key, String suffix, JsonWriter jw) {
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeAscii(key);
    jw.writeAscii(suffix);
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeByte(JsonWriter.SEMI);
    jw.writeByte(JsonWriter.OBJECT_START);
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeAscii("value");
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeByte(JsonWriter.SEMI);
}
 
Example 2
Source File: AttributeObjectNonDefaultEncoder.java    From dsl-json with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(final JsonWriter writer, @Nullable final T value) {
	final R attr = read.apply(value);
	if (attr != null && attr != defaultValue) {
		writer.writeAscii(quotedName);
		encoder.write(writer, attr);
	}
}
 
Example 3
Source File: MainActivity.java    From dsl-json with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void serialize(JsonWriter writer, boolean minimal) {
    writer.writeAscii("{\"x\":");
    NumberConverter.serialize(x, writer);
    writer.writeAscii(",\"s\":");
    StringConverter.serialize(s, writer);
    writer.writeAscii("}");
}
 
Example 4
Source File: MainActivity.java    From dsl-json with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void serialize(JsonWriter writer, boolean minimal) {
    writer.writeAscii("{\"x\":");
    NumberConverter.serialize(x, writer);
    writer.writeAscii(",\"s\":");
    StringConverter.serialize(s, writer);
    writer.writeAscii("}");
}
 
Example 5
Source File: World.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void serialize(JsonWriter writer, boolean minimal) {
    writer.writeAscii("{\"id\":");
    NumberConverter.serialize(this.id, writer);
    writer.writeAscii(",\"randomNumber\":");
    NumberConverter.serialize(this.randomNumber, writer);
    writer.writeByte(com.dslplatform.json.JsonWriter.OBJECT_END);
}
 
Example 6
Source File: DslJsonSerializer.java    From apm-agent-java with Apache License 2.0 4 votes vote down vote up
public static void writeFieldName(final String fieldName, final JsonWriter jw) {
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeAscii(fieldName);
    jw.writeByte(JsonWriter.QUOTE);
    jw.writeByte(JsonWriter.SEMI);
}
 
Example 7
Source File: AttributeObjectAlwaysEncoder.java    From dsl-json with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(final JsonWriter writer, @Nullable final T value) {
	final R attr = read.apply(value);
	writer.writeAscii(quotedName);
	encoder.write(writer, attr);
}