use of java.text.StringCharacterIterator in project rabbitmq-java-client by rabbitmq.
the class JSONWriter method string.
private void string(Object obj) {
add('"');
CharacterIterator it = new StringCharacterIterator(obj.toString());
for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {
if (c == '"')
add("\\\"");
else if (c == '\\')
add("\\\\");
else if (c == '/')
add("\\/");
else if (c == '\b')
add("\\b");
else if (c == '\f')
add("\\f");
else if (c == '\n')
add("\\n");
else if (c == '\r')
add("\\r");
else if (c == '\t')
add("\\t");
else if (Character.isISOControl(c)) {
unicode(c);
} else {
add(c);
}
}
add('"');
}
Aggregations