docs: private static void printCodePoint(Appendable out, int c, EscapeMode mode)
          throws IOException
      {
          // JSON only allows uHHHH numeric escapes.
          switch (c) {
              case 0:
                  out.append(mode == EscapeMode.JSON ? "\\u0000" : "\\0");
                  return;
              case '\t':
                  out.append("\\t");
                  return;
              case '\n':
                  if (mode == EscapeMode.ION_LONG_STRING) {
                      out.append('\n');
                  }
                  else {
                      out.append("\\n");
                  }
                  return;
              case '\r':
                  out.append("\\r");
                  return;
              case '\f':
                  out.append("\\f");
                  return;
              case '\u0008':
                  out.append("\\b");
                  return;
              case '\u0007':
                  out.append(mode == EscapeMode.JSON ? "\\u0007" : "\\a");
                  return;
              case '\u000B':
                  out.append(mode == EscapeMode.JSON ? "\\u000b" : "\\v");
                  return;
              case '\"':
                  if (mode == EscapeMode.JSON || mode == EscapeMode.ION_STRING) {
                      out.append("\\\"");
                      return;
                  }
                  break; // Treat as normal code point for long string or symbol.
              case '\'':
                  if (mode == EscapeMode.ION_SYMBOL ||
                      mode == EscapeMode.ION_LONG_STRING)
                  {
                      out.append("\\\'");
                      return;
                  }
                  break;
              case '\\':
                  out.append("\\\\");
                  return;
              default:
                  break;
          }
  
          if (c < 32) {
              if (mode == EscapeMode.JSON) {
                  printCodePointAsFourHexDigits(out, c);
              }
              else {
                  printCodePointAsTwoHexDigits(out, c);
              }
          }
          else if (c < 0x7F) {  // Printable ASCII
              out.append((char)c);
          }
          else if (c <= 0xFF) {
              if (mode == EscapeMode.JSON) {
                  printCodePointAsFourHexDigits(out, c);
              }
              else {
                  printCodePointAsTwoHexDigits(out, c);
              }
          }
          else if (c <= 0xFFFF) {
              printCodePointAsFourHexDigits(out, c);
          }
          else {
              if (mode == EscapeMode.JSON) {
                  // JSON does not have a \Uxxxxyyyy escape, surrogates
                  // must be used as per RFC-4627
                  //
                  // http://www.ietf.org/rfc/rfc4627.txt
                  // [...]
                  //   To escape an extended character that is not in the Basic Multilingual
                  //   Plane, the character is represented as a twelve-character sequence,
                  //   encoding the UTF-16 surrogate pair.  So, for example, a string
                  //   containing only the G clef character (U+1D11E) may be represented as
                  //   "\uD834\uDD1E".
                  // [...]
                  printCodePointAsSurrogatePairHexDigits(out, c);
              }
              else {
                  printCodePointAsEightHexDigits(out, c);
              }
          }
      }