當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericGF類代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:17,代碼來源:Encoder.java

示例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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:Encoder.java

示例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;
  }
}
 
開發者ID:SudarAbisheck,項目名稱:ZXing-Orient,代碼行數:17,代碼來源:Encoder.java

示例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;
    }
}
 
開發者ID:Ag47,項目名稱:TrueTone,代碼行數:17,代碼來源:Encoder.java

示例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;
    }
}
 
開發者ID:yakovenkodenis,項目名稱:Discounty,代碼行數:17,代碼來源:Encoder.java

示例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;
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:20,代碼來源:Encoder.java

示例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;
  }
}
 
開發者ID:yinglovezhuzhu,項目名稱:ZxingCore,代碼行數:17,代碼來源:Encoder.java

示例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;
}
 
開發者ID:tiphedor,項目名稱:qrcodegenerator,代碼行數:25,代碼來源:QRCodeGenerator.java

示例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;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:15,代碼來源:Encoder.java

示例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;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:39,代碼來源:Detector.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:15,代碼來源:Encoder.java

示例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();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:30,代碼來源:Detector.java

示例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");
    }

}
 
開發者ID:dieforfree,項目名稱:qart4j,代碼行數:34,代碼來源:Bits.java


注:本文中的com.google.zxing.common.reedsolomon.GenericGF類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。