/** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). * It's the same as JSONValue.escape() only for compatibility here. * * @see org.json.simple.JSONValue#escape(String) * * @param s * @return */ public static String escape(String s){ return JSONValue.escape(s); } }
/** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). * @param s * @return */ public static String escape(String s){ if(s==null) return null; StringBuffer sb = new StringBuffer(); escape(s, sb); return sb.toString(); }
private static String toJSONString(String key,Object value, StringBuffer sb){ sb.append('\"'); if(key == null) sb.append("null"); else JSONValue.escape(key, sb); sb.append('\"').append(':'); sb.append(JSONValue.toJSONString(value)); return sb.toString(); }
nodeSB.append("\"name\":\"").append(JSONValue.escape(name)).append("\"").append(","); nodeSB.append("\"asize\":").append(dataLen).append(","); nodeSB.append("\"dsize\":").append(dataLen).append(",");
return "\""+escape((String)value)+"\"";
out.write(escape((String)value)); out.write('\"'); return;
/** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). * It's the same as JSONValue.escape() only for compatibility here. * * @see org.json.simple.JSONValue#escape(String) * * @param s * @return the value */ public static String escape(String s){ return JSONValue.escape(s); } }
/** * Returns a string representing this <tt>EndpointInfo</tt> in JSON * format. * @return a string representing this <tt>EndpointInfo</tt> in JSON * format. */ private String getJSON() { return "{\"id\":\"" + JSONValue.escape(id) + "\",\"displayName\":\"" + JSONValue.escape(displayName) + "\"}"; } }
/** * @param endpoint the ID of the dominant speaker endpoint in this * multipoint conference. * * @return a new <tt>String</tt> which represents a message to be sent * to an endpoint in order to notify it that the dominant speaker in its * multipoint conference has changed to a specific endpoint. */ public static String createDominantSpeakerEndpointChangeEvent( String endpoint) { return "{\"colibriClass\":\"" + COLIBRI_CLASS_DOMINANT_SPEAKER_CHANGE + "\"," + "\"dominantSpeakerEndpoint\":\"" + JSONValue.escape(endpoint) + "\"}"; }
/** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). * @param s * @return the value */ public static String escape(String s){ if(s==null) return null; StringBuffer sb = new StringBuffer(); escape(s, sb); return sb.toString(); }
/** * Creates a string which represents a message of type * {@link #COLIBRI_CLASS_ENDPOINT_CONNECTIVITY_STATUS}. * in order to notify it * @param endpointId ? * @param connected ? */ public static String createEndpointConnectivityStatusChangeEvent( String endpointId, boolean connected) { return "{\"colibriClass\":\"" + COLIBRI_CLASS_ENDPOINT_CONNECTIVITY_STATUS + "\",\"endpoint\":\"" + JSONValue.escape(endpointId) +"\", \"active\":\"" + String.valueOf(connected) + "\"}"; }
private static String toJSONString(String key,Object value, StringBuffer sb){ sb.append('\"'); if(key == null) sb.append("null"); else JSONValue.escape(key, sb); sb.append('\"').append(':'); sb.append(JSONValue.toJSONString(value)); return sb.toString(); }
return "\""+escape((String)value)+"\"";
out.write(escape((String)value)); out.write('\"'); return;
private static Object serializeSourceGroup( SourceGroupPacketExtension sourceGroup) { if (sourceGroup.getSemantics() != null && sourceGroup.getSemantics().length() != 0 && sourceGroup.getSources() != null && sourceGroup.getSources().size() != 0) { JSONObject sourceGroupJSONObject = new JSONObject(); // Add semantics sourceGroupJSONObject.put( SourceGroupPacketExtension.SEMANTICS_ATTR_NAME, JSONValue.escape(sourceGroup.getSemantics())); // Add sources JSONArray ssrcsJSONArray = new JSONArray(); for (SourcePacketExtension source : sourceGroup.getSources()) ssrcsJSONArray.add(Long.valueOf(source.getSSRC())); sourceGroupJSONObject.put(SOURCES, ssrcsJSONArray); return sourceGroupJSONObject; } else { return null; } }
/** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). * @param s * @return */ public static String escape(String s){ if(s==null) return null; StringBuffer sb = new StringBuffer(); escape(s, sb); return sb.toString(); }
public static String toString(String key,Object value){ StringBuffer sb = new StringBuffer(); sb.append('\"'); if(key == null) sb.append("null"); else JSONValue.escape(key, sb); sb.append('\"').append(':'); sb.append(JSONValue.toJSONString(value)); return sb.toString(); }
public static String toString(String key,Object value){ StringBuffer sb = new StringBuffer(); sb.append('\"'); if(key == null) sb.append("null"); else JSONValue.escape(key, sb); sb.append('\"').append(':'); sb.append(JSONValue.toJSONString(value)); return sb.toString(); }
public void write(Confidence object) throws IOException { MIJsonUtils.writeStartObject(writer); MIJsonUtils.writeProperty("type", JSONValue.escape(object.getType().getShortName()), writer); MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("value", JSONValue.escape(object.getValue()), writer); MIJsonUtils.writeEndObject(writer); } }
public void write(Xref object) throws IOException { MIJsonUtils.writeStartObject(writer); MIJsonUtils.writeProperty("db", JSONValue.escape(object.getDatabase().getShortName()), writer); MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("id", JSONValue.escape(object.getId()), writer); MIJsonUtils.writeEndObject(writer); } }