Java 类com.google.zxing.qrcode.decoder.Mode 实例源码

项目:weex-3d-map    文件:Encoder.java   
/**
 * 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;
}
项目:weex-3d-map    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:QrCode    文件:Encoder.java   
/**
 * 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;
}
项目:QrCode    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:boohee_v5.6    文件:Encoder.java   
static void appendBytes(String content, Mode mode, BitArray bits, String encoding) throws
        WriterException {
    switch (mode) {
        case NUMERIC:
            appendNumericBytes(content, bits);
            return;
        case ALPHANUMERIC:
            appendAlphanumericBytes(content, bits);
            return;
        case BYTE:
            append8BitBytes(content, bits, encoding);
            return;
        case KANJI:
            appendKanjiBytes(content, bits);
            return;
        default:
            throw new WriterException("Invalid mode: " + mode);
    }
}
项目:Tesseract-OCR-Scanner    文件:Encoder.java   
/**
 * 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;
}
项目:Tesseract-OCR-Scanner    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:QrCodeScanner    文件:Encoder.java   
/**
 * 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;
}
项目:QrCodeScanner    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:PortraitZXing    文件:Encoder.java   
/**
 * 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;
}
项目:PortraitZXing    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:PortraitZXing    文件:Encoder.java   
/**
 * 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;
}
项目:PortraitZXing    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:ZXing-Orient    文件:Encoder.java   
/**
 * 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;
}
项目:ZXing-Orient    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:event-app    文件:Encoder.java   
/**
 * 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;
}
项目:event-app    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:weex-analyzer-android    文件:Encoder.java   
/**
 * 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;
}
项目:weex-analyzer-android    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:weex-3d-map    文件:Encoder.java   
/**
 * 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;
}
项目:weex-3d-map    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:Weex-TestDemo    文件:Encoder.java   
/**
 * 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;
}
项目:Weex-TestDemo    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:Cardstore    文件:Encoder.java   
/**
 * 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;
}
项目:Cardstore    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:QrScan_Demo    文件:Encoder.java   
/**
 * 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;
}
项目:QrScan_Demo    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:weex    文件:Encoder.java   
/**
 * 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;
}
项目:weex    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:sres-app    文件:Encoder.java   
/**
 * 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;
}
项目:sres-app    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:TrueTone    文件:Encoder.java   
/**
 * 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;
}
项目:TrueTone    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
    switch (mode) {
        case NUMERIC:
            appendNumericBytes(content, bits);
            break;
        case ALPHANUMERIC:
            appendAlphanumericBytes(content, bits);
            break;
        case BYTE:
            append8BitBytes(content, bits, encoding);
            break;
        case KANJI:
            appendKanjiBytes(content, bits);
            break;
        default:
            throw new WriterException("Invalid mode: " + mode);
    }
}
项目:Discounty    文件:Encoder.java   
/**
 * 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;
}
项目:Discounty    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
    switch (mode) {
        case NUMERIC:
            appendNumericBytes(content, bits);
            break;
        case ALPHANUMERIC:
            appendAlphanumericBytes(content, bits);
            break;
        case BYTE:
            append8BitBytes(content, bits, encoding);
            break;
        case KANJI:
            appendKanjiBytes(content, bits);
            break;
        default:
            throw new WriterException("Invalid mode: " + mode);
    }
}
项目:bushido-android-app    文件:Encoder.java   
/**
 * 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 com.google.zxing.qrcode.decoder.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;
}
项目:bushido-android-app    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:reacteu-app    文件:Encoder.java   
/**
 * 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;
}
项目:reacteu-app    文件:Encoder.java   
/**
 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
 */
static void appendBytes(String content,
                        Mode mode,
                        BitArray bits,
                        String encoding) throws WriterException {
  switch (mode) {
    case NUMERIC:
      appendNumericBytes(content, bits);
      break;
    case ALPHANUMERIC:
      appendAlphanumericBytes(content, bits);
      break;
    case BYTE:
      append8BitBytes(content, bits, encoding);
      break;
    case KANJI:
      appendKanjiBytes(content, bits);
      break;
    default:
      throw new WriterException("Invalid mode: " + mode);
  }
}
项目:Android-Birdcopy-Application    文件:Encoder.java   
/**
 * 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;
}