/// <summary> Identify where the end of the middle / payload section ends.
///
/// </summary>
/// <param name="row">row of black/white values to search
/// </param>
/// <returns> Array, containing index of start of 'end block' and end of 'end
/// block'
/// </returns>
/// <throws> ReaderException </throws>
internal int[] decodeEnd(BitArray row)
{
// For convenience, reverse the row and then
// search from 'the start' for the end block
row.reverse();
try
{
int endStart = skipWhiteSpace(row);
int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);
// The start & end patterns must be pre/post fixed by a quiet zone. This
// zone must be at least 10 times the width of a narrow line.
// ref: http://www.barcode-1.net/i25code.html
validateQuietZone(row, endPattern[0]);
// Now recalculate the indices of where the 'endblock' starts & stops to
// accommodate
// the reversed nature of the search
int temp = endPattern[0];
endPattern[0] = row.Size - endPattern[1];
endPattern[1] = row.Size - temp;
return endPattern;
}
finally
{
// Put the row back the right way.
row.reverse();
}
}