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


Java ReedSolomonException类代码示例

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


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

示例1: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
/**
 * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
 * correct the errors in-place using Reed-Solomon error correction.</p>
 *
 * @param codewordBytes data and error correction codewords
 * @param numDataCodewords number of codewords that are data bytes
 * @throws ChecksumException if error correction fails
 */
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws ChecksumException {
  int numCodewords = codewordBytes.length;
  // First read into an array of ints
  int[] codewordsInts = new int[numCodewords];
  for (int i = 0; i < numCodewords; i++) {
    codewordsInts[i] = codewordBytes[i] & 0xFF;
  }
  int numECCodewords = codewordBytes.length - numDataCodewords;
  try {
    rsDecoder.decode(codewordsInts, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw ChecksumException.getChecksumInstance();
  }
  // Copy back into array of bytes -- only need to worry about the bytes that were data
  // We don't care about errors in the error-correction codewords
  for (int i = 0; i < numDataCodewords; i++) {
    codewordBytes[i] = (byte) codewordsInts[i];
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:28,代码来源:Decoder.java

示例2: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
/**
 * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
 * correct the errors in-place using Reed-Solomon error correction.</p>
 *
 * @param codewordBytes data and error correction codewords
 * @param numDataCodewords number of codewords that are data bytes
 * @throws ChecksumException if error correction fails
 */
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws ChecksumException {
  int numCodewords = codewordBytes.length;
  // First read into an array of ints
  int[] codewordsInts = new int[numCodewords];
  for (int i = 0; i < numCodewords; i++) {
    codewordsInts[i] = codewordBytes[i] & 0xFF;
  }
  try {
    rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
  } catch (ReedSolomonException ignored) {
    throw ChecksumException.getChecksumInstance();
  }
  // Copy back into array of bytes -- only need to worry about the bytes that were data
  // We don't care about errors in the error-correction codewords
  for (int i = 0; i < numDataCodewords; i++) {
    codewordBytes[i] = (byte) codewordsInts[i];
  }
}
 
开发者ID:10045125,项目名称:QrCode,代码行数:27,代码来源:Decoder.java

示例3: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws
        ChecksumException {
    int i;
    int numCodewords = codewordBytes.length;
    int[] codewordsInts = new int[numCodewords];
    for (i = 0; i < numCodewords; i++) {
        codewordsInts[i] = codewordBytes[i] & 255;
    }
    try {
        this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
        for (i = 0; i < numDataCodewords; i++) {
            codewordBytes[i] = (byte) codewordsInts[i];
        }
    } catch (ReedSolomonException e) {
        throw ChecksumException.getChecksumInstance();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:Decoder.java

示例4: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
private void correctErrors(byte[] codewordBytes, int start, int dataCodewords, int
        ecCodewords, int mode) throws ChecksumException {
    int codewords = dataCodewords + ecCodewords;
    int divisor = mode == 0 ? 1 : 2;
    int[] codewordsInts = new int[(codewords / divisor)];
    int i = 0;
    while (i < codewords) {
        if (mode == 0 || i % 2 == mode - 1) {
            codewordsInts[i / divisor] = codewordBytes[i + start] & 255;
        }
        i++;
    }
    try {
        this.rsDecoder.decode(codewordsInts, ecCodewords / divisor);
        i = 0;
        while (i < dataCodewords) {
            if (mode == 0 || i % 2 == mode - 1) {
                codewordBytes[i + start] = (byte) codewordsInts[i / divisor];
            }
            i++;
        }
    } catch (ReedSolomonException e) {
        throw ChecksumException.getChecksumInstance();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:26,代码来源:Decoder.java

示例5: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
/**
 * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
 * correct the errors in-place using Reed-Solomon error correction.</p>
 *
 * @param codewordBytes data and error correction codewords
 * @param numDataCodewords number of codewords that are data bytes
 * @throws ChecksumException if error correction fails
 */
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws ChecksumException {
  int numCodewords = codewordBytes.length;
  // First read into an array of ints
  int[] codewordsInts = new int[numCodewords];
  for (int i = 0; i < numCodewords; i++) {
    codewordsInts[i] = codewordBytes[i] & 0xFF;
  }
  int numECCodewords = codewordBytes.length - numDataCodewords;
  try {
    rsDecoder.decode(codewordsInts, numECCodewords);
  } catch (ReedSolomonException rse) {
    throw ChecksumException.getChecksumInstance();
  }
  // Copy back into array of bytes -- only need to worry about the bytes that were data
  // We don't care about errors in the error-correction codewords
  for (int i = 0; i < numDataCodewords; i++) {
    codewordBytes[i] = (byte) codewordsInts[i];
  }
}
 
开发者ID:atomsheep,项目名称:sres-app,代码行数:28,代码来源:Decoder.java

示例6: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
/**
 * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
 * correct the errors in-place using Reed-Solomon error correction.</p>
 *
 * @param codewordBytes    data and error correction codewords
 * @param numDataCodewords number of codewords that are data bytes
 * @throws ChecksumException if error correction fails
 */
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws ChecksumException {
    int numCodewords = codewordBytes.length;
    // First read into an array of ints
    int[] codewordsInts = new int[numCodewords];
    for (int i = 0; i < numCodewords; i++) {
        codewordsInts[i] = codewordBytes[i] & 0xFF;
    }
    int numECCodewords = codewordBytes.length - numDataCodewords;
    try {
        rsDecoder.decode(codewordsInts, numECCodewords);
    } catch (ReedSolomonException ignored) {
        throw ChecksumException.getChecksumInstance();
    }
    // Copy back into array of bytes -- only need to worry about the bytes that were data
    // We don't care about errors in the error-correction codewords
    for (int i = 0; i < numDataCodewords; i++) {
        codewordBytes[i] = (byte) codewordsInts[i];
    }
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:28,代码来源:Decoder.java

示例7: correctErrors

import com.google.zxing.common.reedsolomon.ReedSolomonException; //导入依赖的package包/类
/**
 * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
 * correct the errors in-place using Reed-Solomon error correction.</p>
 *
 * @param codewordBytes data and error correction codewords
 * @param numDataCodewords number of codewords that are data bytes
 * @throws com.google.zxing.ChecksumException if error correction fails
 */
private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws ChecksumException {
  int numCodewords = codewordBytes.length;
  // First read into an array of ints
  int[] codewordsInts = new int[numCodewords];
  for (int i = 0; i < numCodewords; i++) {
    codewordsInts[i] = codewordBytes[i] & 0xFF;
  }
  int numECCodewords = codewordBytes.length - numDataCodewords;
  try {
    rsDecoder.decode(codewordsInts, numECCodewords);
  } catch (ReedSolomonException ignored) {
    throw ChecksumException.getChecksumInstance();
  }
  // Copy back into array of bytes -- only need to worry about the bytes that were data
  // We don't care about errors in the error-correction codewords
  for (int i = 0; i < numDataCodewords; i++) {
    codewordBytes[i] = (byte) codewordsInts[i];
  }
}
 
开发者ID:bushidowallet,项目名称:bushido-android-app,代码行数:28,代码来源:Decoder.java


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