mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
check format param in CodaBarWriter::encode (#1173)
This commit is contained in:
parent
4b573da62a
commit
2d77cec7c8
|
@ -16,6 +16,13 @@
|
|||
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class renders CodaBar as {@code boolean[]}.
|
||||
*
|
||||
|
@ -28,6 +35,19 @@ public final class CodaBarWriter extends OneDimensionalCodeWriter {
|
|||
private static final char[] CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = {'/', ':', '+', '.'};
|
||||
private static final char DEFAULT_GUARD = START_END_CHARS[0];
|
||||
|
||||
@Override
|
||||
public BitMatrix encode(String contents,
|
||||
BarcodeFormat format,
|
||||
int width,
|
||||
int height,
|
||||
Map<EncodeHintType,?> hints) throws WriterException {
|
||||
if (format != BarcodeFormat.CODABAR) {
|
||||
throw new IllegalArgumentException("Can only encode CODABAR, but got " + format);
|
||||
}
|
||||
|
||||
return super.encode(contents, format, width, height, hints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] encode(String contents) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue