class EAN8Reader extends UPCEANReader {

  private final int[] decodeMiddleCounters;

  public EAN8Reader() {
    decodeMiddleCounters = new int[4];
  }

  @Override
  protected int decodeMiddle(BitArray row,
                             int[] startRange,
                             StringBuilder result) throws NotFoundException {<FILL_FUNCTION_BODY>}

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

}

    int[] counters = decodeMiddleCounters;
    counters[0] = 0;
    counters[1] = 0;
    counters[2] = 0;
    counters[3] = 0;
    int end = row.getSize();
    int rowOffset = startRange[1];

    for (int x = 0; x < 4 && rowOffset < end; x++) {
      int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
      result.append((char) ('0' + bestMatch));
      for (int counter : counters) {
        rowOffset += counter;
      }
    }

    int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN);
    rowOffset = middleRange[1];

    for (int x = 0; x < 4 && rowOffset < end; x++) {
      int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
      result.append((char) ('0' + bestMatch));
      for (int counter : counters) {
        rowOffset += counter;
      }
    }

    return rowOffset;
  
<methods>public com.google.zxing.Result decodeRow(int, com.google.zxing.common.BitArray, Map<com.google.zxing.DecodeHintType,?>) throws com.google.zxing.NotFoundException, com.google.zxing.ChecksumException, com.google.zxing.FormatException,public com.google.zxing.Result decodeRow(int, com.google.zxing.common.BitArray, int[], Map<com.google.zxing.DecodeHintType,?>) throws com.google.zxing.NotFoundException, com.google.zxing.ChecksumException, com.google.zxing.FormatException<variables>static final int[] END_PATTERN,static final non-sealed int[][] L_AND_G_PATTERNS,static final int[][] L_PATTERNS,private static final float MAX_AVG_VARIANCE,private static final float MAX_INDIVIDUAL_VARIANCE,static final int[] MIDDLE_PATTERN,static final int[] START_END_PATTERN,private final non-sealed java.lang.StringBuilder decodeRowStringBuffer,private final non-sealed com.google.zxing.oned.EANManufacturerOrgSupport eanManSupport,private final non-sealed com.google.zxing.oned.UPCEANExtensionSupport extensionReader