@Override public final BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException { return encode(contents, format, width, height, null); }
@Override public final BitMatrix encode(String contents, BarcodeFormat format, int width, int height) throws WriterException { return encode(contents, format, width, height, null); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_128) { throw new IllegalArgumentException("Can only encode CODE_128, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_128) { throw new IllegalArgumentException("Can only encode CODE_128, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.ITF) { throw new IllegalArgumentException("Can only encode ITF, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_39) { throw new IllegalArgumentException("Can only encode CODE_39, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_39) { throw new IllegalArgumentException("Can only encode CODE_39, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_93) { throw new IllegalArgumentException("Can only encode CODE_93, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.ITF) { throw new IllegalArgumentException("Can only encode ITF, but got " + format); } return super.encode(contents, format, width, height, hints); }
@Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (format != BarcodeFormat.CODE_93) { throw new IllegalArgumentException("Can only encode CODE_93, but got " + format); } return super.encode(contents, format, width, height, hints); }
/** * Encode the contents following specified format. * {@code width} and {@code height} are required size. This method may return bigger size * {@code BitMatrix} when specified size is too small. The user can set both {@code width} and * {@code height} to zero to get minimum size barcode. If negative value is set to {@code width} * or {@code height}, {@code IllegalArgumentException} is thrown. */ @Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (contents.isEmpty()) { throw new IllegalArgumentException("Found empty contents"); } if (width < 0 || height < 0) { throw new IllegalArgumentException("Negative size is not allowed. Input: " + width + 'x' + height); } int sidesMargin = getDefaultMargin(); if (hints != null && hints.containsKey(EncodeHintType.MARGIN)) { sidesMargin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString()); } boolean[] code = encode(contents); return renderResult(code, width, height, sidesMargin); }
/** * Encode the contents following specified format. * {@code width} and {@code height} are required size. This method may return bigger size * {@code BitMatrix} when specified size is too small. The user can set both {@code width} and * {@code height} to zero to get minimum size barcode. If negative value is set to {@code width} * or {@code height}, {@code IllegalArgumentException} is thrown. */ @Override public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Map<EncodeHintType,?> hints) throws WriterException { if (contents.isEmpty()) { throw new IllegalArgumentException("Found empty contents"); } if (width < 0 || height < 0) { throw new IllegalArgumentException("Negative size is not allowed. Input: " + width + 'x' + height); } int sidesMargin = getDefaultMargin(); if (hints != null && hints.containsKey(EncodeHintType.MARGIN)) { sidesMargin = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString()); } boolean[] code = encode(contents); return renderResult(code, width, height, sidesMargin); }