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;
  }
}