ITFReader.java (zxing-zxing-3.4.1) | : | ITFReader.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 24 | skipping to change at line 24 | |||
* limitations under the License. | * limitations under the License. | |||
*/ | */ | |||
package com.google.zxing.oned; | package com.google.zxing.oned; | |||
import com.google.zxing.BarcodeFormat; | import com.google.zxing.BarcodeFormat; | |||
import com.google.zxing.DecodeHintType; | import com.google.zxing.DecodeHintType; | |||
import com.google.zxing.FormatException; | import com.google.zxing.FormatException; | |||
import com.google.zxing.NotFoundException; | import com.google.zxing.NotFoundException; | |||
import com.google.zxing.Result; | import com.google.zxing.Result; | |||
import com.google.zxing.ResultMetadataType; | ||||
import com.google.zxing.ResultPoint; | import com.google.zxing.ResultPoint; | |||
import com.google.zxing.common.BitArray; | import com.google.zxing.common.BitArray; | |||
import java.util.Map; | import java.util.Map; | |||
/** | /** | |||
* <p>Implements decoding of the ITF format, or Interleaved Two of Five.</p> | * <p>Implements decoding of the ITF format, or Interleaved Two of Five.</p> | |||
* | * | |||
* <p>This Reader will scan ITF barcodes of certain lengths only. | * <p>This Reader will scan ITF barcodes of certain lengths only. | |||
* At the moment it reads length 6, 8, 10, 12, 14, 16, 18, 20, 24, and 44 as the se have appeared "in the wild". Not all | * At the moment it reads length 6, 8, 10, 12, 14, 16, 18, 20, 24, and 44 as the se have appeared "in the wild". Not all | |||
skipping to change at line 142 | skipping to change at line 143 | |||
maxAllowedLength = allowedLength; | maxAllowedLength = allowedLength; | |||
} | } | |||
} | } | |||
if (!lengthOK && length > maxAllowedLength) { | if (!lengthOK && length > maxAllowedLength) { | |||
lengthOK = true; | lengthOK = true; | |||
} | } | |||
if (!lengthOK) { | if (!lengthOK) { | |||
throw FormatException.getFormatInstance(); | throw FormatException.getFormatInstance(); | |||
} | } | |||
return new Result( | Result resultObject = new Result( | |||
resultString, | resultString, | |||
null, // no natural byte representation for these barcodes | null, // no natural byte representation for these barcodes | |||
new ResultPoint[] {new ResultPoint(startRange[1], rowNumber), | new ResultPoint[] {new ResultPoint(startRange[1], rowNumber), | |||
new ResultPoint(endRange[0], rowNumber)}, | new ResultPoint(endRange[0], rowNumber)}, | |||
BarcodeFormat.ITF); | BarcodeFormat.ITF); | |||
resultObject.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]I0"); | ||||
return resultObject; | ||||
} | } | |||
/** | /** | |||
* @param row row of black/white values to search | * @param row row of black/white values to search | |||
* @param payloadStart offset of start pattern | * @param payloadStart offset of start pattern | |||
* @param resultString {@link StringBuilder} to append decoded chars to | * @param resultString {@link StringBuilder} to append decoded chars to | |||
* @throws NotFoundException if decoding could not complete successfully | * @throws NotFoundException if decoding could not complete successfully | |||
*/ | */ | |||
private static void decodeMiddle(BitArray row, | private static void decodeMiddle(BitArray row, | |||
int payloadStart, | int payloadStart, | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added |