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


Java BarcodeFormat.CODE_39屬性代碼示例

本文整理匯總了Java中com.google.zxing.BarcodeFormat.CODE_39屬性的典型用法代碼示例。如果您正苦於以下問題:Java BarcodeFormat.CODE_39屬性的具體用法?Java BarcodeFormat.CODE_39怎麽用?Java BarcodeFormat.CODE_39使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.zxing.BarcodeFormat的用法示例。


在下文中一共展示了BarcodeFormat.CODE_39屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parse

public VINParsedResult parse(Result result) {
    if (result.getBarcodeFormat() != BarcodeFormat.CODE_39) {
        return null;
    }
    String rawText = IOQ.matcher(result.getText()).replaceAll("").trim();
    if (!AZ09.matcher(rawText).matches()) {
        return null;
    }
    try {
        if (!checkChecksum(rawText)) {
            return null;
        }
        String wmi = rawText.substring(0, 3);
        return new VINParsedResult(rawText, wmi, rawText.substring(3, 9), rawText.substring
                (9, 17), countryCode(wmi), rawText.substring(3, 8), modelYear(rawText.charAt
                (9)), rawText.charAt(10), rawText.substring(11));
    } catch (IllegalArgumentException e) {
        return null;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:20,代碼來源:VINResultParser.java

示例2: encode

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.CODE_39) {
    throw new IllegalArgumentException("Can only encode CODE_39, but got " + format);
  }
  return super.encode(contents, format, width, height, hints);
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:11,代碼來源:Code39Writer.java

示例3: parse

@Override
public VINParsedResult parse(Result result) {
  if (result.getBarcodeFormat() != BarcodeFormat.CODE_39) {
    return null;
  }
  String rawText = result.getText();
  rawText = IOQ.matcher(rawText).replaceAll("").trim();
  if (!AZ09.matcher(rawText).matches()) {
    return null;
  }
  try {
    if (!checkChecksum(rawText)) {
      return null;
    }
    String wmi = rawText.substring(0, 3);
    return new VINParsedResult(rawText,
        wmi,
        rawText.substring(3, 9),
        rawText.substring(9, 17),
        countryCode(wmi),
        rawText.substring(3, 8),
        modelYear(rawText.charAt(9)),
        rawText.charAt(10),
        rawText.substring(11));
  } catch (IllegalArgumentException iae) {
    return null;
  }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:28,代碼來源:VINResultParser.java

示例4: onItemSelected

/**
 * Generates the chosen format from the spinner menu
 */
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
    String compare = adapterView.getItemAtPosition(position).toString();
    if(compare.equals("BARCODE")){
        format = BarcodeFormat.CODABAR;
    }
    else if(compare.equals("CODE_128")){
        format = BarcodeFormat.CODE_128;
    }
    else if(compare.equals("CODE_39")){
        format = BarcodeFormat.CODE_39;
    }
    else if(compare.equals("EAN_13")){
        format = BarcodeFormat.EAN_13;
    }
    else if(compare.equals("EAN_8")){
        format = BarcodeFormat.EAN_8;
    }
    else if(compare.equals("ITF")){
        format = BarcodeFormat.ITF;
    }
    else if(compare.equals("PDF_417")){
        format = BarcodeFormat.PDF_417;
    }
    else if(compare.equals("UPC_A")){
        format = BarcodeFormat.UPC_A;
    }
}
 
開發者ID:Fr4gorSoftware,項目名稱:SecScanQR,代碼行數:31,代碼來源:BarcodeGenerateActivity.java

示例5: onItemSelected

/**
 * Generates the chosen format from the spinner menu
 */
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    String compare = parent.getItemAtPosition(position).toString();
    if(compare.equals("AZTEC")){
        format = BarcodeFormat.AZTEC;
    }
    else if(compare.equals("CODABAR")){
        format = BarcodeFormat.CODABAR;
    }
    else if(compare.equals("CODE_128")){
        format = BarcodeFormat.CODE_128;
    }
    else if(compare.equals("CODE_39")){
        format = BarcodeFormat.CODE_39;
    }
    else if(compare.equals("EAN_13")){
        format = BarcodeFormat.EAN_13;
    }
    else if(compare.equals("EAN_8")){
        format = BarcodeFormat.EAN_8;
    }
    else if(compare.equals("ITF")){
        format = BarcodeFormat.ITF;
    }
    else if(compare.equals("PDF_417")){
        format = BarcodeFormat.PDF_417;
    }
    else if(compare.equals("QR_CODE")){
        format = BarcodeFormat.QR_CODE;
    }
    else if(compare.equals("UPC_A")){
        format = BarcodeFormat.UPC_A;
    }
}
 
開發者ID:Fr4gorSoftware,項目名稱:SecScanQR,代碼行數:37,代碼來源:GenerateActivity.java

示例6: encode

public BitMatrix encode(String contents, BarcodeFormat format, int width, int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
    if (format == BarcodeFormat.CODE_39) {
        return super.encode(contents, format, width, height, hints);
    }
    throw new IllegalArgumentException("Can only encode CODE_39, but got " + format);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:7,代碼來源:Code39Writer.java

示例7: parseBarCodeString

/**
 * Parse barcodes as BarcodeFormat constants.
 *
 * Supports all iOS codes except [code39mod43, itf14]
 *
 * Additionally supports [codabar, maxicode, rss14, rssexpanded, upca, upceanextension]
 */
private BarcodeFormat parseBarCodeString(String c) {
    if ("aztec".equals(c)) {
        return BarcodeFormat.AZTEC;
    } else if ("ean13".equals(c)) {
        return BarcodeFormat.EAN_13;
    } else if ("ean8".equals(c)) {
        return BarcodeFormat.EAN_8;
    } else if ("qr".equals(c)) {
        return BarcodeFormat.QR_CODE;
    } else if ("pdf417".equals(c)) {
        return BarcodeFormat.PDF_417;
    } else if ("upce".equals(c)) {
        return BarcodeFormat.UPC_E;
    } else if ("datamatrix".equals(c)) {
        return BarcodeFormat.DATA_MATRIX;
    } else if ("code39".equals(c)) {
        return BarcodeFormat.CODE_39;
    } else if ("code93".equals(c)) {
        return BarcodeFormat.CODE_93;
    } else if ("interleaved2of5".equals(c)) {
        return BarcodeFormat.ITF;
    } else if ("codabar".equals(c)) {
        return BarcodeFormat.CODABAR;
    } else if ("code128".equals(c)) {
        return BarcodeFormat.CODE_128;
    } else if ("maxicode".equals(c)) {
        return BarcodeFormat.MAXICODE;
    } else if ("rss14".equals(c)) {
        return BarcodeFormat.RSS_14;
    } else if ("rssexpanded".equals(c)) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if ("upca".equals(c)) {
        return BarcodeFormat.UPC_A;
    } else if ("upceanextension".equals(c)) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    } else {
        android.util.Log.v("RCTCamera", "Unsupported code.. [" + c + "]");
        return null;
    }
}
 
開發者ID:jonathan68,項目名稱:react-native-camera,代碼行數:47,代碼來源:RCTCameraViewFinder.java

示例8: decodeRow

public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> map) throws
        NotFoundException, ChecksumException, FormatException {
    int lastStart;
    int[] theCounters = this.counters;
    Arrays.fill(theCounters, 0);
    StringBuilder result = this.decodeRowResult;
    result.setLength(0);
    int[] start = findAsteriskPattern(row, theCounters);
    int nextStart = row.getNextSet(start[1]);
    int end = row.getSize();
    char decodedChar;
    do {
        OneDReader.recordPattern(row, nextStart, theCounters);
        int pattern = toNarrowWidePattern(theCounters);
        if (pattern < 0) {
            throw NotFoundException.getNotFoundInstance();
        }
        decodedChar = patternToChar(pattern);
        result.append(decodedChar);
        lastStart = nextStart;
        for (int counter : theCounters) {
            nextStart += counter;
        }
        nextStart = row.getNextSet(nextStart);
    } while (decodedChar != '*');
    result.setLength(result.length() - 1);
    int lastPatternSize = 0;
    for (int counter2 : theCounters) {
        lastPatternSize += counter2;
    }
    int whiteSpaceAfterEnd = (nextStart - lastStart) - lastPatternSize;
    if (nextStart == end || whiteSpaceAfterEnd * 2 >= lastPatternSize) {
        if (this.usingCheckDigit) {
            int max = result.length() - 1;
            int total = 0;
            for (int i = 0; i < max; i++) {
                total += ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(i));
            }
            if (result.charAt(max) != ALPHABET[total % 43]) {
                throw ChecksumException.getChecksumInstance();
            }
            result.setLength(max);
        }
        if (result.length() == 0) {
            throw NotFoundException.getNotFoundInstance();
        }
        String resultString;
        if (this.extendedMode) {
            resultString = decodeExtended(result);
        } else {
            resultString = result.toString();
        }
        float left = ((float) (start[1] + start[0])) / 2.0f;
        float right = ((float) lastStart) + (((float) lastPatternSize) / 2.0f);
        return new Result(resultString, null, new ResultPoint[]{new ResultPoint(left, (float)
                rowNumber), new ResultPoint(right, (float) rowNumber)}, BarcodeFormat.CODE_39);
    }
    throw NotFoundException.getNotFoundInstance();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:59,代碼來源:Code39Reader.java


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