use of org.grails.encoder.StreamingEncoderWritable in project grails-core by grails.
the class JSONObject method writeQuoted.
static void writeQuoted(Writer writer, Object value) throws IOException {
if (useStreamingJavascriptEncoder) {
writer.write("\"");
if (value.getClass() == String.class || value.getClass() == StringBuilder.class || value.getClass() == StringBuffer.class) {
encodeToWriter((CharSequence) value, writer);
} else if (value instanceof StreamingEncoderWritable) {
((StreamingEncoderWritable) value).encodeTo(writer, javascriptEncoderStateless);
} else if (value instanceof Writable) {
((Writable) value).writeTo(new StreamingEncoderWriter(writer, javascriptEncoder, null));
} else {
encodeToWriter(value.toString(), writer);
}
writer.write("\"");
} else {
writer.write(valueToString(value));
}
}
Aggregations