下面列出了com.google.zxing.BarcodeFormat# RSS_EXPANDED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
private static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException{
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(
resultingString,
null,
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
}
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;
}
private static BarcodeFormat formatToSymbol(int format) {
if (225 == format) {
return BarcodeFormat.AZTEC;
} else if (38 == format) {
return BarcodeFormat.CODABAR;
} else if (128 == format) {
return BarcodeFormat.CODE_128;
} else if (39 == format) {
return BarcodeFormat.CODE_39;
} else if (93 == format) {
return BarcodeFormat.CODE_93;
} else if (200 == format) {
return BarcodeFormat.DATA_MATRIX;
} else if (13 == format) {
return BarcodeFormat.EAN_13;
} else if (8 == format) {
return BarcodeFormat.EAN_8;
} else if (25 == format) {
return BarcodeFormat.ITF;
} else if (94 == format) {
return BarcodeFormat.MAXICODE;
} else if (57 == format) {
return BarcodeFormat.PDF_417;
} else if (64 == format) {
return BarcodeFormat.QR_CODE;
} else if (34 == format) {
return BarcodeFormat.RSS_14;
} else if (35 == format) {
return BarcodeFormat.RSS_EXPANDED;
} else if (12 == format) {
return BarcodeFormat.UPC_A;
} else if (9 == format) {
return BarcodeFormat.UPC_E;
} else if (15 == format) {
return BarcodeFormat.UPC_EAN_EXTENSION;
}
return null;
}
private static Result a(List list)
{
String s = AbstractExpandedDecoder.createDecoder(com.google.zxing.oned.rss.expanded.a.a(list)).parseInformation();
ResultPoint aresultpoint[] = ((b)list.get(0)).d().getResultPoints();
ResultPoint aresultpoint1[] = ((b)list.get(-1 + list.size())).d().getResultPoints();
ResultPoint aresultpoint2[] = new ResultPoint[4];
aresultpoint2[0] = aresultpoint[0];
aresultpoint2[1] = aresultpoint[1];
aresultpoint2[2] = aresultpoint1[0];
aresultpoint2[3] = aresultpoint1[1];
return new Result(s, null, aresultpoint2, BarcodeFormat.RSS_EXPANDED);
}
/**
* 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;
}
}
public ExpandedProductParsedResult parse(Result result)
{
if (result.getBarcodeFormat() != BarcodeFormat.RSS_EXPANDED)
{
return null;
}
String s = result.getText();
if (s == null)
{
return null;
}
String s1 = null;
String s2 = null;
String s3 = null;
String s4 = null;
String s5 = null;
String s6 = null;
String s7 = null;
String s8 = null;
String s9 = null;
String s10 = null;
String s11 = null;
String s12 = null;
String s13 = null;
HashMap hashmap = new HashMap();
int i = 0;
while (i < s.length())
{
String s14 = a(i, s);
if (s14 == null)
{
return null;
}
int j = i + (2 + s14.length());
String s15 = b(j, s);
int k = j + s15.length();
if ("00".equals(s14))
{
s2 = s15;
} else
if ("01".equals(s14))
{
s1 = s15;
} else
if ("10".equals(s14))
{
s3 = s15;
} else
if ("11".equals(s14))
{
s4 = s15;
} else
if ("13".equals(s14))
{
s5 = s15;
} else
if ("15".equals(s14))
{
s6 = s15;
} else
if ("17".equals(s14))
{
s7 = s15;
} else
if ("3100".equals(s14) || "3101".equals(s14) || "3102".equals(s14) || "3103".equals(s14) || "3104".equals(s14) || "3105".equals(s14) || "3106".equals(s14) || "3107".equals(s14) || "3108".equals(s14) || "3109".equals(s14))
{
s9 = "KG";
s10 = s14.substring(3);
s8 = s15;
} else
if ("3200".equals(s14) || "3201".equals(s14) || "3202".equals(s14) || "3203".equals(s14) || "3204".equals(s14) || "3205".equals(s14) || "3206".equals(s14) || "3207".equals(s14) || "3208".equals(s14) || "3209".equals(s14))
{
s9 = "LB";
s10 = s14.substring(3);
s8 = s15;
} else
if ("3920".equals(s14) || "3921".equals(s14) || "3922".equals(s14) || "3923".equals(s14))
{
s12 = s14.substring(3);
s11 = s15;
} else
if ("3930".equals(s14) || "3931".equals(s14) || "3932".equals(s14) || "3933".equals(s14))
{
if (s15.length() < 4)
{
return null;
}
s11 = s15.substring(3);
s13 = s15.substring(0, 3);
s12 = s14.substring(3);
} else
{
hashmap.put(s14, s15);
}
i = k;
}
return new ExpandedProductParsedResult(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, hashmap);
}