下面列出了怎么用com.google.zxing.oned.rss.expanded.RSSExpandedReader的API类实例代码及写法,或者点击链接到github查看源代码。
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) {
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) {
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) {
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)){
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)){
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)){
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
@SuppressWarnings("unchecked")
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) {
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
public MultiFormatOneDReader(Map<DecodeHintType,?> hints) {
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
boolean useCode39CheckDigit = hints != null &&
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
Collection<OneDReader> readers = new ArrayList<OneDReader>();
if (possibleFormats != null) {
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
possibleFormats.contains(BarcodeFormat.EAN_8) ||
possibleFormats.contains(BarcodeFormat.UPC_E)) {
readers.add(new MultiFormatUPCEANReader(hints));
}
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
readers.add(new Code39Reader(useCode39CheckDigit));
}
if (possibleFormats.contains(BarcodeFormat.CODE_93)) {
readers.add(new Code93Reader());
}
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
readers.add(new Code128Reader());
}
if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader());
}
if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader());
}
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)){
readers.add(new RSSExpandedReader());
}
}
if (readers.isEmpty()) {
readers.add(new MultiFormatUPCEANReader(hints));
readers.add(new Code39Reader());
readers.add(new CodaBarReader());
readers.add(new Code93Reader());
readers.add(new Code128Reader());
readers.add(new ITFReader());
readers.add(new RSS14Reader());
readers.add(new RSSExpandedReader());
}
this.readers = readers.toArray(new OneDReader[readers.size()]);
}
/**
* Returns a ZXing reader that can read the specified symbol.
*
* @param symbol the symbol to be read
* @return a ZXing reader that can read the specified symbol
*/
private static Reader findReader(Symbol symbol) {
// TODO: see if we can massage data enough to check MaxiCode symbols against MaxiCodeReader instances
if (symbol instanceof Code128 || symbol instanceof UspsPackage) {
return new Code128Reader();
} else if (symbol instanceof Code93) {
return new Code93Reader();
} else if (symbol instanceof Code3Of9) {
return new Code39Reader();
} else if (symbol instanceof Codabar) {
return new CodaBarReader();
} else if (symbol instanceof AztecCode &&
symbol.getDataType() != DataType.GS1 &&
symbol.getEciMode() == 3 &&
!symbol.getReaderInit() &&
!symbol.getContent().isEmpty()) {
// ZXing does not currently support GS1 in Aztec Code symbols
// ZXing does not currently support ECI in Aztec Code symbols
// ZXing does not currently support reader initialization in Aztec Code symbols
// ZXing cannot find symbols if they don't contain any actual data
return new AztecReader();
} else if (symbol instanceof QrCode) {
return new QRCodeReader();
} else if (symbol instanceof DataMatrix &&
symbol.getEciMode() == 3 &&
((DataMatrix) symbol).getStructuredAppendTotal() == 1) {
// ZXing does not currently support ECI in Data Matrix symbols
// ZXing does not currently support Structured Append in Data Matrix symbols
return new DataMatrixReader();
} else if (symbol instanceof Ean) {
Ean ean = (Ean) symbol;
if (ean.getMode() == Ean.Mode.EAN8) {
return new EAN8Reader();
} else {
return new EAN13Reader();
}
} else if (symbol instanceof Pdf417) {
Pdf417 pdf417 = (Pdf417) symbol;
if (pdf417.getMode() != Pdf417.Mode.MICRO) {
return new PDF417Reader();
}
} else if (symbol instanceof Upc) {
Upc upc = (Upc) symbol;
if (upc.getMode() == Upc.Mode.UPCA) {
return new UPCAReader();
} else {
return new UPCEReader();
}
} else if (symbol instanceof DataBarExpanded) {
return new RSSExpandedReader();
} else if (symbol instanceof DataBar14 && !((DataBar14) symbol).getLinkageFlag()) {
return new RSS14Reader();
}
// no corresponding ZXing reader exists, or it behaves badly so we don't use it for testing
return null;
}