com.google.zxing.BarcodeFormat# EAN_8 ( ) 源码实例Demo

下面列出了com.google.zxing.BarcodeFormat# EAN_8 ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。


@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);
}
 
源代码2 项目: RipplePower   文件: ProductResultParser.java

@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);
}
 

@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);
}
 

@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);
}
 
源代码5 项目: weex   文件: ProductResultParser.java

@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);
}
 

private static int symbolToFormat(BarcodeFormat symbol) {
    if (BarcodeFormat.AZTEC == symbol) {
        return 225;
    } else if (BarcodeFormat.CODABAR == symbol) {
        return 38;
    } else if (BarcodeFormat.CODE_128 == symbol) {
        return 128;
    } else if (BarcodeFormat.CODE_39 == symbol) {
        return 39;
    } else if (BarcodeFormat.CODE_93 == symbol) {
        return 93;
    } else if (BarcodeFormat.DATA_MATRIX == symbol) {
        return 200;
    } else if (BarcodeFormat.EAN_13 == symbol) {
        return 13;
    } else if (BarcodeFormat.EAN_8 == symbol) {
        return 8;
    } else if (BarcodeFormat.ITF == symbol) {
        return 25;
    } else if (BarcodeFormat.MAXICODE == symbol) {
        return 94;
    } else if (BarcodeFormat.PDF_417 == symbol) {
        return 57;
    } else if (BarcodeFormat.QR_CODE == symbol) {
        return 64;
    } else if (BarcodeFormat.RSS_14 == symbol) {
        return 34;
    } else if (BarcodeFormat.RSS_EXPANDED == symbol) {
        return 35;
    } else if (BarcodeFormat.UPC_A == symbol) {
        return 12;
    } else if (BarcodeFormat.UPC_E == symbol) {
        return 9;
    } else if (BarcodeFormat.UPC_EAN_EXTENSION == symbol) {
        return 15;
    }
    return -1;
}
 
源代码7 项目: RipplePower   文件: EAN8Writer.java

@Override
public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType, ?> hints)
		throws WriterException {
	if (format != BarcodeFormat.EAN_8) {
		throw new IllegalArgumentException("Can only encode EAN_8, but got " + format);
	}

	return super.encode(contents, format, width, height, hints);
}
 
源代码8 项目: ScreenCapture   文件: EAN8Writer.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.EAN_8) {
    throw new IllegalArgumentException("Can only encode EAN_8, but got "
        + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码9 项目: SecScanQR   文件: GeneralHandler.java

/**
 * Method is used to convert parsed id to BarcodeFormat to create an image of the qr code
 * @param id as int
 * @return format as BarcodeFormat
 */
public BarcodeFormat idToBarcodeFormat(int id){
    BarcodeFormat format;
    switch(id){
        case 1:
            format = BarcodeFormat.CODABAR;
            break;
        case 2:
            format= BarcodeFormat.CODE_128;
            break;
        case 3:
            format = BarcodeFormat.CODE_39;
            break;
        case 4:
            format = BarcodeFormat.EAN_13;
            break;
        case 5:
            format = BarcodeFormat.EAN_8;
            break;
        case 6:
            format = BarcodeFormat.ITF;
            break;
        case 7:
            format = BarcodeFormat.PDF_417;
            break;
        case 8:
            format = BarcodeFormat.UPC_A;
            break;
        case 9:
            format = BarcodeFormat.QR_CODE;
            break;
        case 10:
            format = BarcodeFormat.AZTEC;
            break;
        default:
            format = BarcodeFormat.CODABAR;
            break;
    }
    return format;
}
 
源代码10 项目: SecScanQR   文件: GeneralHandler.java

/**
 * Method is used to convert parsed String to BarcodeFormat to create an image of the qr code
 * @param stringFormat as String
 * @return format as BarcodeFormat
 */
public BarcodeFormat StringToBarcodeFormat(String stringFormat){
    BarcodeFormat format;
    switch(stringFormat){
        case "CODBAR":
            format = BarcodeFormat.CODABAR;
            break;
        case "CODE_128":
            format= BarcodeFormat.CODE_128;
            break;
        case "CODE_39":
            format = BarcodeFormat.CODE_39;
            break;
        case "EAN_13":
            format = BarcodeFormat.EAN_13;
            break;
        case "EAN_8":
            format = BarcodeFormat.EAN_8;
            break;
        case "ITF":
            format = BarcodeFormat.ITF;
            break;
        case "PDF_417":
            format = BarcodeFormat.PDF_417;
            break;
        case "UPC_A":
            format = BarcodeFormat.UPC_A;
            break;
        case "QR_CODE":
            format = BarcodeFormat.QR_CODE;
            break;
        case "AZTEC":
            format = BarcodeFormat.AZTEC;
            break;
        default:
            format = BarcodeFormat.CODABAR;
            break;
    }
    return format;
}
 
源代码11 项目: MiBandDecompiled   文件: EAN8Writer.java

public BitMatrix encode(String s, BarcodeFormat barcodeformat, int i, int j, Map map)
{
    if (barcodeformat != BarcodeFormat.EAN_8)
    {
        throw new IllegalArgumentException((new StringBuilder()).append("Can only encode EAN_8, but got ").append(barcodeformat).toString());
    } else
    {
        return super.encode(s, barcodeformat, i, j, map);
    }
}
 
源代码12 项目: QrCodeScanner   文件: EAN8Writer.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.EAN_8) {
    throw new IllegalArgumentException("Can only encode EAN_8, but got "
        + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码13 项目: ZXing-Orient   文件: EAN8Writer.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.EAN_8) {
    throw new IllegalArgumentException("Can only encode EAN_8, but got "
        + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType,?> hints) throws WriterException {
  if (format != BarcodeFormat.EAN_8) {
    throw new IllegalArgumentException("Can only encode EAN_8, but got "
        + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码15 项目: reacteu-app   文件: ProductResultParser.java

@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);
  int length = rawText.length();
  for (int x = 0; x < length; x++) {
    char c = rawText.charAt(x);
    if (c < '0' || c > '9') {
      return null;
    }
  }
  // Not actually checking the checksum again here    

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

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
源代码16 项目: ScreenCapture   文件: EAN8Reader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.EAN_8;
}
 
源代码17 项目: MiBandDecompiled   文件: EAN8Reader.java

BarcodeFormat a()
{
    return BarcodeFormat.EAN_8;
}
 
源代码18 项目: ZXing-Orient   文件: EAN8Reader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.EAN_8;
}
 

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.EAN_8;
}
 
源代码20 项目: weex   文件: EAN8Reader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.EAN_8;
}