本文整理匯總了Java中com.google.zxing.common.reedsolomon.GenericGF類的典型用法代碼示例。如果您正苦於以下問題:Java GenericGF類的具體用法?Java GenericGF怎麽用?Java GenericGF使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GenericGF類屬於com.google.zxing.common.reedsolomon包,在下文中一共展示了GenericGF類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
private static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
throw new IllegalArgumentException("Unsupported word size " + wordSize);
}
}
示例2: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
private static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
throw new IllegalArgumentException("Unsupported word size " + wordSize);
}
}
示例3: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
private static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
return null;
}
}
示例4: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
private static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
return null;
}
}
示例5: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
return null;
}
}
示例6: a
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
static byte[] a(byte abyte0[], int i)
{
int j = 0;
int k = abyte0.length;
int ai[] = new int[k + i];
for (int l = 0; l < k; l++)
{
ai[l] = 0xff & abyte0[l];
}
(new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256)).encode(ai, i);
byte abyte1[] = new byte[i];
for (; j < i; j++)
{
abyte1[j] = (byte)ai[k + j];
}
return abyte1;
}
示例7: getGF
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
static GenericGF getGF(int wordSize) {
switch (wordSize) {
case 4:
return GenericGF.AZTEC_PARAM;
case 6:
return GenericGF.AZTEC_DATA_6;
case 8:
return GenericGF.AZTEC_DATA_8;
case 10:
return GenericGF.AZTEC_DATA_10;
case 12:
return GenericGF.AZTEC_DATA_12;
default:
return null;
}
}
示例8: generateECBytes
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
/**
* Generate the Error correction codewords thanks to the Zxing external library.
*
* @todo auto convert int array to byte string
*
* @param dataBytes
* @param numEcBytesInBlock
* @return ecInt
*/
public int[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
int numDataBytes = dataBytes.length;
int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
for (int i = 0; i < numDataBytes; i++) {
toEncode[i] = dataBytes[i] & 0xFF;
}
new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
int[] ecInt = new int[numEcBytesInBlock];
for (int i = 0; i < numEcBytesInBlock; i++) {
ecInt[i] = (int) ((byte) toEncode[numDataBytes + i] & 0xFF) ;
}
return ecInt;
}
示例9: generateECBytes
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
int numDataBytes = dataBytes.length;
int[] toEncode = new int[numDataBytes + numEcBytesInBlock];
for (int i = 0; i < numDataBytes; i++) {
toEncode[i] = dataBytes[i] & 0xFF;
}
new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
byte[] ecBytes = new byte[numEcBytesInBlock];
for (int i = 0; i < numEcBytesInBlock; i++) {
ecBytes[i] = (byte) toEncode[numDataBytes + i];
}
return ecBytes;
}
示例10: getCorrectedParameterData
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
/**
* Corrects the parameter bits using Reed-Solomon algorithm.
*
* @param parameterData parameter bits
* @param compact true if this is a compact Aztec code
* @throws NotFoundException if the array contains too many errors
*/
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
int numCodewords;
int numDataCodewords;
if (compact) {
numCodewords = 7;
numDataCodewords = 2;
} else {
numCodewords = 10;
numDataCodewords = 4;
}
int numECCodewords = numCodewords - numDataCodewords;
int[] parameterWords = new int[numCodewords];
for (int i = numCodewords - 1; i >= 0; --i) {
parameterWords[i] = (int) parameterData & 0xF;
parameterData >>= 4;
}
try {
ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
rsDecoder.decode(parameterWords, numECCodewords);
} catch (ReedSolomonException ignored) {
throw NotFoundException.getNotFoundInstance();
}
// Toss the error correction. Just return the data as an integer
int result = 0;
for (int i = 0; i < numDataCodewords; i++) {
result = (result << 4) + parameterWords[i];
}
return result;
}
示例11: generateECBytes
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
static byte[] generateECBytes(byte[] dataBytes, int numEcBytesInBlock) {
int i;
int numDataBytes = dataBytes.length;
int[] toEncode = new int[(numDataBytes + numEcBytesInBlock)];
for (i = 0; i < numDataBytes; i++) {
toEncode[i] = dataBytes[i] & 255;
}
new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
byte[] ecBytes = new byte[numEcBytesInBlock];
for (i = 0; i < numEcBytesInBlock; i++) {
ecBytes[i] = (byte) toEncode[numDataBytes + i];
}
return ecBytes;
}
示例12: getCorrectedParameterData
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
private static int getCorrectedParameterData(long parameterData, boolean compact) throws
NotFoundException {
int numCodewords;
int numDataCodewords;
int i;
if (compact) {
numCodewords = 7;
numDataCodewords = 2;
} else {
numCodewords = 10;
numDataCodewords = 4;
}
int numECCodewords = numCodewords - numDataCodewords;
int[] parameterWords = new int[numCodewords];
for (i = numCodewords - 1; i >= 0; i--) {
parameterWords[i] = ((int) parameterData) & 15;
parameterData >>= 4;
}
try {
new ReedSolomonDecoder(GenericGF.AZTEC_PARAM).decode(parameterWords, numECCodewords);
int result = 0;
for (i = 0; i < numDataCodewords; i++) {
result = (result << 4) + parameterWords[i];
}
return result;
} catch (ReedSolomonException e) {
throw NotFoundException.getNotFoundInstance();
}
}
示例13: addCheckBytes
import com.google.zxing.common.reedsolomon.GenericGF; //導入依賴的package包/類
public void addCheckBytes(Version version, Level level) throws QArtException {
int numberOfDataBytes = version.dataBytes(level);
if (this.size < numberOfDataBytes*8) {
pad(numberOfDataBytes*8 - this.size);
}
if (this.size != numberOfDataBytes*8) {
throw new IllegalArgumentException("qr: too much data");
}
Version.VersionInfo versionInfo = Version.VERSION_INFOS[version.getVersion()];
Version.VersionLevelInfo levelInfo = versionInfo.levelInfos[level.ordinal()];
int numberOfDataBytesPerBlock = numberOfDataBytes / levelInfo.numberOfBlocks;
int numberOfExtraBytes = numberOfDataBytes % levelInfo.numberOfBlocks;
ReedSolomonEncoder reedSolomonEncoder = new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256);
int dataIndex = 0;
for(int i = 0;i < levelInfo.numberOfBlocks;i++){
if(i == levelInfo.numberOfBlocks - numberOfExtraBytes) {
numberOfDataBytesPerBlock++;
}
byte[] checkBytes = ReedSolomonUtil.generateECBytes(reedSolomonEncoder, this.bits, dataIndex, numberOfDataBytesPerBlock, levelInfo.numberOfCheckBytesPerBlock);
dataIndex += numberOfDataBytesPerBlock;
this.append(new Bits(checkBytes, levelInfo.numberOfCheckBytesPerBlock * 8));
}
if(this.size/8 != versionInfo.bytes) {
throw new QArtException("qr: internal error");
}
}