Java Code Examples for com.google.zxing.BarcodeFormat#UPC_E

The following examples show how to use com.google.zxing.BarcodeFormat#UPC_E . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProductResultParser.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
Example 2
Source File: ProductResultParser.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
Example 3
Source File: ProductResultParser.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
@Override
public ProductParsedResult parse(Result result) {
	BarcodeFormat format = result.getBarcodeFormat();
	if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E || format == BarcodeFormat.EAN_8
			|| format == BarcodeFormat.EAN_13)) {
		return null;
	}
	String rawText = getMassagedText(result);
	if (!isStringOfDigits(rawText, rawText.length())) {
		return null;
	}
	// Not actually checking the checksum again here

	String normalizedProductID;
	// Expand UPC-E for purposes of searching
	if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
		normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
	} else {
		normalizedProductID = rawText;
	}

	return new ProductParsedResult(rawText, normalizedProductID);
}
 
Example 4
Source File: ProductResultParser.java    From weex with Apache License 2.0 6 votes vote down vote up
@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
Example 5
Source File: ProductResultParser.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
Example 6
Source File: UPCEWriter.java    From Tesseract-OCR-Scanner with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
Example 7
Source File: UPCEWriter.java    From QrCodeScanner with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
Example 8
Source File: UPCEWriter.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
Example 9
Source File: UPCEWriter.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
Example 10
Source File: UPCEWriter.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
Example 11
Source File: RCTCameraViewFinder.java    From react-native-camera-face-detector with MIT License 4 votes vote down vote up
/**
 * 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;
    }
}
 
Example 12
Source File: UPCEReader.java    From QrCodeScanner with GNU General Public License v3.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 13
Source File: UPCEReader.java    From ZXing-Orient with Apache License 2.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 14
Source File: UPCEReader.java    From reacteu-app with MIT License 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 15
Source File: UPCEReader.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 16
Source File: UPCEReader.java    From Tesseract-OCR-Scanner with Apache License 2.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 17
Source File: UPCEReader.java    From weex with Apache License 2.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 18
Source File: UPCEReader.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
	return BarcodeFormat.UPC_E;
}
 
Example 19
Source File: UPCEReader.java    From ScreenCapture with MIT License 4 votes vote down vote up
@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
Example 20
Source File: UPCEReader.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
BarcodeFormat a()
{
    return BarcodeFormat.UPC_E;
}