- static void appendBytes(final ByteArray bytes, int mode, BitVector bits) throws WriterException {
- switch (mode) {
- case QRCode.MODE_NUMERIC:
- appendNumericBytes(bytes, bits);
- break;
- case QRCode.MODE_ALPHANUMERIC:
- appendAlphanumericBytes(bytes, bits);
- break;
- case QRCode.MODE_8BIT_BYTE:
- append8BitBytes(bytes, bits);
- break;
- case QRCode.MODE_KANJI:
- appendKanjiBytes(bytes, bits);
- break;
- default:
- throw new WriterException("Invalid mode: " + mode);
+ static void appendBytes(final ByteArray bytes, Mode mode, BitVector bits) throws WriterException {
+ if (mode.equals(Mode.NUMERIC)) {
+ appendNumericBytes(bytes, bits);
+ } else if (mode.equals(Mode.ALPHANUMERIC)) {
+ appendAlphanumericBytes(bytes, bits);
+ } else if (mode.equals(Mode.BYTE)) {
+ append8BitBytes(bytes, bits);
+ } else if (mode.equals(Mode.KANJI)) {
+ appendKanjiBytes(bytes, bits);
+ } else {
+ throw new WriterException("Invalid mode: " + mode);