code: private static int quoteSingle(final StringBuilder sb, final String string, final int start) {
          int i = start+1;
          if (needsBlockQuoting(string.charAt(start))) return -i;
          int unquoteLen = 0;
          int quotedMap = 1;
          for (int j = 1; i < string.length(); i++, j++) {
              char c = string.charAt(i);
              if (needsQuoting(c)) {
                  if (j > MAX_SINGLE_QUOTE_LEN || needsBlockQuoting(c)) return -i-1;
                  quotedMap |= 1 << j;
                  unquoteLen = 0;
              } else {
                  if (unquoteLen == MAX_UNQUOTE_LEN ||
                          (quotedMap == 1 && 
                           unquoteLen == MAX_SINGLE_UNQUOTE_LEN)) {
                      break;
                  }
                  unquoteLen++;
              }
          }
          appendSingleQuoted(sb, string, start, i - unquoteLen, quotedMap);
          sb.append(string, i - unquoteLen, i);
          return i;
      }
docs: Tries to quote each character with a backslash.