本文整理匯總了Java中com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.getBits方法的典型用法代碼示例。如果您正苦於以下問題:Java ErrorCorrectionLevel.getBits方法的具體用法?Java ErrorCorrectionLevel.getBits怎麽用?Java ErrorCorrectionLevel.getBits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
的用法示例。
在下文中一共展示了ErrorCorrectionLevel.getBits方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeTypeInfoBits
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; //導入方法依賴的package包/類
static void makeTypeInfoBits(ErrorCorrectionLevel ecLevel, int maskPattern, BitArray bits)
throws WriterException {
if (!QRCode.isValidMaskPattern(maskPattern)) {
throw new WriterException("Invalid mask pattern");
}
int typeInfo = (ecLevel.getBits() << 3) | maskPattern;
bits.appendBits(typeInfo, 5);
int bchCode = calculateBCHCode(typeInfo, TYPE_INFO_POLY);
bits.appendBits(bchCode, 10);
BitArray maskBits = new BitArray();
maskBits.appendBits(TYPE_INFO_MASK_PATTERN, 15);
bits.xor(maskBits);
if (bits.getSize() != 15) { // Just in case.
throw new WriterException("should not happen but we got: " + bits.getSize());
}
}
示例2: makeTypeInfoBits
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; //導入方法依賴的package包/類
static void makeTypeInfoBits(ErrorCorrectionLevel ecLevel, int maskPattern, BitArray bits)
throws WriterException {
if (QRCode.isValidMaskPattern(maskPattern)) {
int typeInfo = (ecLevel.getBits() << 3) | maskPattern;
bits.appendBits(typeInfo, 5);
bits.appendBits(calculateBCHCode(typeInfo, TYPE_INFO_POLY), 10);
BitArray maskBits = new BitArray();
maskBits.appendBits(TYPE_INFO_MASK_PATTERN, 15);
bits.xor(maskBits);
if (bits.getSize() != 15) {
throw new WriterException("should not happen but we got: " + bits.getSize());
}
return;
}
throw new WriterException("Invalid mask pattern");
}