Search in sources :

Example 41 with StringCharacterIterator

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('"');
}
Also used : StringCharacterIterator(java.text.StringCharacterIterator) CharacterIterator(java.text.CharacterIterator) StringCharacterIterator(java.text.StringCharacterIterator)

Aggregations

StringCharacterIterator (java.text.StringCharacterIterator)41 CharacterIterator (java.text.CharacterIterator)20 Nullable (org.jetbrains.annotations.Nullable)3 ClsFormatException (com.intellij.util.cls.ClsFormatException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Logger (com.intellij.openapi.diagnostic.Logger)1 Pair (com.intellij.openapi.util.Pair)1 Pair.pair (com.intellij.openapi.util.Pair.pair)1 StringUtil (com.intellij.openapi.util.text.StringUtil)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LanguageLevel (com.intellij.pom.java.LanguageLevel)1 CommonClassNames (com.intellij.psi.CommonClassNames)1 PsiNameHelper (com.intellij.psi.PsiNameHelper)1 ModifierFlags (com.intellij.psi.impl.cache.ModifierFlags)1 TypeInfo (com.intellij.psi.impl.cache.TypeInfo)1 com.intellij.psi.impl.java.stubs (com.intellij.psi.impl.java.stubs)1 com.intellij.psi.impl.java.stubs.impl (com.intellij.psi.impl.java.stubs.impl)1 PsiFileStub (com.intellij.psi.stubs.PsiFileStub)1 StubElement (com.intellij.psi.stubs.StubElement)1