Example usage for com.fasterxml.jackson.core.io CharTypes appendQuoted

List of usage examples for com.fasterxml.jackson.core.io CharTypes appendQuoted

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core.io CharTypes appendQuoted.

Prototype

public static void appendQuoted(StringBuilder sb, String content) 

Source Link

Usage

From source file:snow.console.Terminal.java

public void out(String data) {

    if (data == null || data.isEmpty())
        return;//from  www.  j  a v  a 2s . c o  m

    StringBuilder sb = new StringBuilder();

    sb.append("{\"$stdout\": {\"id\": \"").append(id());
    //appendQuoted(sb, id());

    sb.append("\", \"data\": \"");
    CharTypes.appendQuoted(sb, data);

    sb.append("\"}}");

    //System.out.println(sb.toString());

    try {
        ctx.writeAndFlush(new TextWebSocketFrame(sb.toString()));
    } catch (Throwable e) {
        e.printStackTrace();
    }
}