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


Java DecoderResult.setOther方法代码示例

本文整理汇总了Java中com.google.zxing.common.DecoderResult.setOther方法的典型用法代码示例。如果您正苦于以下问题:Java DecoderResult.setOther方法的具体用法?Java DecoderResult.setOther怎么用?Java DecoderResult.setOther使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.common.DecoderResult的用法示例。


在下文中一共展示了DecoderResult.setOther方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import com.google.zxing.common.DecoderResult; //导入方法依赖的package包/类
static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException {
  StringBuilder result = new StringBuilder(codewords.length * 2);
  Charset encoding = DEFAULT_ENCODING;
  // Get compaction mode
  int codeIndex = 1;
  int code = codewords[codeIndex++];
  PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
  while (codeIndex < codewords[0]) {
    switch (code) {
      case TEXT_COMPACTION_MODE_LATCH:
        codeIndex = textCompaction(codewords, codeIndex, result);
        break;
      case BYTE_COMPACTION_MODE_LATCH:
      case BYTE_COMPACTION_MODE_LATCH_6:
        codeIndex = byteCompaction(code, codewords, encoding, codeIndex, result);
        break;
      case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
        result.append((char) codewords[codeIndex++]);
        break;
      case NUMERIC_COMPACTION_MODE_LATCH:
        codeIndex = numericCompaction(codewords, codeIndex, result);
        break;
      case ECI_CHARSET:
        CharacterSetECI charsetECI =
            CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]);
        encoding = Charset.forName(charsetECI.name());
        break;
      case ECI_GENERAL_PURPOSE:
        // Can't do anything with generic ECI; skip its 2 characters
        codeIndex += 2;
        break;
      case ECI_USER_DEFINED:
        // Can't do anything with user ECI; skip its 1 character
        codeIndex ++;
        break;
      case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
        codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
        break;
      case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
      case MACRO_PDF417_TERMINATOR:
        // Should not see these outside a macro block
        throw FormatException.getFormatInstance();
      default:
        // Default to text compaction. During testing numerous barcodes
        // appeared to be missing the starting mode. In these cases defaulting
        // to text compaction seems to work.
        codeIndex--;
        codeIndex = textCompaction(codewords, codeIndex, result);
        break;
    }
    if (codeIndex < codewords.length) {
      code = codewords[codeIndex++];
    } else {
      throw FormatException.getFormatInstance();
    }
  }
  if (result.length() == 0) {
    throw FormatException.getFormatInstance();
  }
  DecoderResult decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);
  decoderResult.setOther(resultMetadata);
  return decoderResult;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:64,代码来源:DecodedBitStreamParser.java

示例2: decode

import com.google.zxing.common.DecoderResult; //导入方法依赖的package包/类
static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException {
    StringBuilder result = new StringBuilder(codewords.length * 2);
    Charset encoding = DEFAULT_ENCODING;
    int codeIndex = 1 + 1;
    int code = codewords[1];
    PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
    int codeIndex2 = codeIndex;
    while (codeIndex2 < codewords[0]) {
        switch (code) {
            case TEXT_COMPACTION_MODE_LATCH /*900*/:
                codeIndex2 = textCompaction(codewords, codeIndex2, result);
                break;
            case BYTE_COMPACTION_MODE_LATCH /*901*/:
            case BYTE_COMPACTION_MODE_LATCH_6 /*924*/:
                codeIndex2 = byteCompaction(code, codewords, encoding, codeIndex2, result);
                break;
            case NUMERIC_COMPACTION_MODE_LATCH /*902*/:
                codeIndex2 = numericCompaction(codewords, codeIndex2, result);
                break;
            case MODE_SHIFT_TO_BYTE_COMPACTION_MODE /*913*/:
                codeIndex = codeIndex2 + 1;
                result.append((char) codewords[codeIndex2]);
                codeIndex2 = codeIndex;
                break;
            case MACRO_PDF417_TERMINATOR /*922*/:
            case BEGIN_MACRO_PDF417_OPTIONAL_FIELD /*923*/:
                throw FormatException.getFormatInstance();
            case ECI_USER_DEFINED /*925*/:
                codeIndex2++;
                break;
            case ECI_GENERAL_PURPOSE /*926*/:
                codeIndex2 += 2;
                break;
            case ECI_CHARSET /*927*/:
                codeIndex = codeIndex2 + 1;
                encoding = Charset.forName(CharacterSetECI.getCharacterSetECIByValue
                        (codewords[codeIndex2]).name());
                codeIndex2 = codeIndex;
                break;
            case 928:
                codeIndex2 = decodeMacroBlock(codewords, codeIndex2, resultMetadata);
                break;
            default:
                codeIndex2 = textCompaction(codewords, codeIndex2 - 1, result);
                break;
        }
        if (codeIndex2 < codewords.length) {
            codeIndex = codeIndex2 + 1;
            code = codewords[codeIndex2];
            codeIndex2 = codeIndex;
        } else {
            throw FormatException.getFormatInstance();
        }
    }
    if (result.length() == 0) {
        throw FormatException.getFormatInstance();
    }
    DecoderResult decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);
    decoderResult.setOther(resultMetadata);
    return decoderResult;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:62,代码来源:DecodedBitStreamParser.java

示例3: decode

import com.google.zxing.common.DecoderResult; //导入方法依赖的package包/类
static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException {
  StringBuilder result = new StringBuilder(codewords.length * 2);
  // Get compaction mode
  int codeIndex = 1;
  int code = codewords[codeIndex++];
  PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
  while (codeIndex < codewords[0]) {
    switch (code) {
      case TEXT_COMPACTION_MODE_LATCH:
        codeIndex = textCompaction(codewords, codeIndex, result);
        break;
      case BYTE_COMPACTION_MODE_LATCH:
      case BYTE_COMPACTION_MODE_LATCH_6:
      case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
        codeIndex = byteCompaction(code, codewords, codeIndex, result);
        break;
      case NUMERIC_COMPACTION_MODE_LATCH:
        codeIndex = numericCompaction(codewords, codeIndex, result);
        break;
      case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
        codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
        break;
      case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
      case MACRO_PDF417_TERMINATOR:
        // Should not see these outside a macro block
        throw FormatException.getFormatInstance();
      default:
        // Default to text compaction. During testing numerous barcodes
        // appeared to be missing the starting mode. In these cases defaulting
        // to text compaction seems to work.
        codeIndex--;
        codeIndex = textCompaction(codewords, codeIndex, result);
        break;
    }
    if (codeIndex < codewords.length) {
      code = codewords[codeIndex++];
    } else {
      throw FormatException.getFormatInstance();
    }
  }
  if (result.length() == 0) {
    throw FormatException.getFormatInstance();
  }
  DecoderResult decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);
  decoderResult.setOther(resultMetadata);
  return decoderResult;
}
 
开发者ID:SudarAbisheck,项目名称:ZXing-Orient,代码行数:48,代码来源:DecodedBitStreamParser.java


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