encodeChar method

  1. @override
int encodeChar(
  1. int chr,
  2. StringBuffer sb
)
override

Implementation

@override
int encodeChar(int chr, StringBuffer sb) {
  switch (chr) {
    case 13: // '\r':
      sb.write('\x00');
      break;
    case 42: // '*':
      sb.write('\x01');
      break;
    case 62: // '>':
      sb.write('\x02');
      break;
    case 32: // ' ':
      sb.write('\x03');
      break;
    default:
      if (chr >= 48 /* 0 */ && chr <= 57 /* 9 */) {
        sb.writeCharCode(chr - 48 + 4);
      } else if (chr >= 65 /* A */ && chr <= 90 /* Z */) {
        sb.writeCharCode(chr - 65 + 14);
      } else {
        HighLevelEncoder.illegalCharacter(chr);
      }
      break;
  }
  return 1;
}