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


Java PDF417Common.NUMBER_OF_CODEWORDS属性代码示例

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


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

示例1: generateErrorCorrection

static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) {
    int j;
    int k = getErrorCorrectionCodewordCount(errorCorrectionLevel);
    char[] e = new char[k];
    int sld = dataCodewords.length();
    for (int i = 0; i < sld; i++) {
        int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % PDF417Common.NUMBER_OF_CODEWORDS;
        for (j = k - 1; j >= 1; j--) {
            e[j] = (char) ((e[j - 1] + (929 - ((EC_COEFFICIENTS[errorCorrectionLevel][j] *
                    t1) % PDF417Common.NUMBER_OF_CODEWORDS))) % PDF417Common
                    .NUMBER_OF_CODEWORDS);
        }
        e[0] = (char) ((929 - ((EC_COEFFICIENTS[errorCorrectionLevel][0] * t1) % PDF417Common
                .NUMBER_OF_CODEWORDS)) % PDF417Common.NUMBER_OF_CODEWORDS);
    }
    StringBuilder sb = new StringBuilder(k);
    for (j = k - 1; j >= 0; j--) {
        if (e[j] != '\u0000') {
            e[j] = (char) (929 - e[j]);
        }
        sb.append(e[j]);
    }
    return sb.toString();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:PDF417ErrorCorrection.java

示例2: generateBarcodeLogic

public void generateBarcodeLogic(String msg, int errorCorrectionLevel) throws WriterException {
    int errorCorrectionCodeWords = PDF417ErrorCorrection.getErrorCorrectionCodewordCount
            (errorCorrectionLevel);
    String highLevel = PDF417HighLevelEncoder.encodeHighLevel(msg, this.compaction, this
            .encoding);
    int sourceCodeWords = highLevel.length();
    int[] dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWords);
    int cols = dimension[0];
    int rows = dimension[1];
    int pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows);
    if ((sourceCodeWords + errorCorrectionCodeWords) + 1 > PDF417Common.NUMBER_OF_CODEWORDS) {
        throw new WriterException("Encoded message contains to many code words, message to " +
                "big (" + msg.length() + " bytes)");
    }
    int n = (sourceCodeWords + pad) + 1;
    StringBuilder stringBuilder = new StringBuilder(n);
    stringBuilder.append((char) n);
    stringBuilder.append(highLevel);
    for (int i = 0; i < pad; i++) {
        stringBuilder.append('΄');
    }
    String dataCodewords = stringBuilder.toString();
    String fullCodewords = dataCodewords + PDF417ErrorCorrection.generateErrorCorrection
            (dataCodewords, errorCorrectionLevel);
    this.barcodeMatrix = new BarcodeMatrix(rows, cols);
    encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, this.barcodeMatrix);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:PDF417.java


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