当前位置: 首页>>代码示例>>Java>>正文


Java Mode类代码示例

本文整理汇总了Java中com.google.zxing.qrcode.decoder.Mode的典型用法代码示例。如果您正苦于以下问题:Java Mode类的具体用法?Java Mode怎么用?Java Mode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Mode类属于com.google.zxing.qrcode.decoder包,在下文中一共展示了Mode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chooseMode

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:30,代码来源:Encoder.java

示例2: appendBytes

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:Encoder.java

示例3: appendBytes

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:Encoder.java

示例4: chooseMode

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SudarAbisheck,项目名称:ZXing-Orient,代码行数:30,代码来源:Encoder.java

示例5: chooseMode

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:30,代码来源:Encoder.java

示例6: appendBytes

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:25,代码来源:Encoder.java

示例7: chooseMode

import com.google.zxing.qrcode.decoder.Mode; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:bushidowallet,项目名称:bushido-android-app,代码行数:30,代码来源:Encoder.java


注:本文中的com.google.zxing.qrcode.decoder.Mode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。