/*
- * Copyright 2008 Google Inc.
+ * Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* <p>Implements decoding of the EAN-8 format.</p>
*
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
*/
public final class EAN8Reader extends AbstractUPCEANReader {
- protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result) throws ReaderException {
+ private final int[] decodeMiddleCounters;
- int[] counters = new int[4];
+ public EAN8Reader() {
+ decodeMiddleCounters = new int[4];
+ }
+
+ protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
+ throws ReaderException {
+ int[] counters = decodeMiddleCounters;
+ counters[0] = 0;
+ counters[1] = 0;
+ counters[2] = 0;
+ counters[3] = 0;
int end = row.getSize();
int rowOffset = startRange[1];