canEncode method

bool canEncode(
  1. Mode mode,
  2. int c
)

Implementation

bool canEncode(Mode mode, int c) {
  switch (mode) {
    case Mode.kanji:
      return isDoubleByteKanji(c);
    case Mode.alphanumeric:
      return isAlphanumeric(c);
    case Mode.numeric:
      return isNumeric(c);
    // any character can be encoded as byte(s). Up to the caller to manage splitting into
    // multiple bytes when String.getBytes(Charset) return more than one byte.
    case Mode.byte:
      return true;

    default:
      return false;
  }
}