Java Code Examples for com.google.zxing.qrcode.decoder.Mode#NUMERIC
The following examples show how to use
com.google.zxing.qrcode.decoder.Mode#NUMERIC .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Encoder.java From ScreenCapture with MIT License | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 2
Source File: Encoder.java From Tesseract-OCR-Scanner with Apache License 2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 3
Source File: Encoder.java From QrCodeScanner with GNU General Public License v3.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 4
Source File: Encoder.java From ZXing-Orient with Apache License 2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding)) { // Choose Kanji mode if all input are double-byte characters return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 5
Source File: Encoder.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 6
Source File: Encoder.java From weex with Apache License 2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 7
Source File: Encoder.java From barcodescanner-lib-aar with MIT License | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 8
Source File: Encoder.java From reacteu-app with MIT License | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding)) { // Choose Kanji mode if all input are double-byte characters return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 9
Source File: Encoder.java From RipplePower with Apache License 2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is * used as a hint; if it is Shift_JIS, and the input is only double-byte * Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding)) { // Choose Kanji mode if all input are double-byte characters return isOnlyDoubleByteKanji(content) ? Mode.KANJI : Mode.BYTE; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 10
Source File: Encoder.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 11
Source File: Encoder.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Choose the best mode by examining the content. Note that 'encoding' is used as a hint; * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. */ private static Mode chooseMode(String content, String encoding) { if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) { // Choose Kanji mode if all input are double-byte characters return Mode.KANJI; } boolean hasNumeric = false; boolean hasAlphanumeric = false; for (int i = 0; i < content.length(); ++i) { char c = content.charAt(i); if (c >= '0' && c <= '9') { hasNumeric = true; } else if (getAlphanumericCode(c) != -1) { hasAlphanumeric = true; } else { return Mode.BYTE; } } if (hasAlphanumeric) { return Mode.ALPHANUMERIC; } if (hasNumeric) { return Mode.NUMERIC; } return Mode.BYTE; }
Example 12
Source File: Encoder.java From MiBandDecompiled with Apache License 2.0 | 4 votes |
private static Mode a(String s, String s1) { int i = 0; if ("Shift_JIS".equals(s1)) { if (a(s)) { return Mode.KANJI; } else { return Mode.BYTE; } } boolean flag = false; boolean flag1 = false; while (i < s.length()) { char c1 = s.charAt(i); if (c1 >= '0' && c1 <= '9') { flag1 = true; } else if (a(c1) != -1) { flag = true; } else { return Mode.BYTE; } i++; } if (flag) { return Mode.ALPHANUMERIC; } if (flag1) { return Mode.NUMERIC; } else { return Mode.BYTE; } }