Barcode-Lib4J requires Java 9+
Package de.vwsoft.barcodelib4j.oned
Java Class «ImplCodabar» – Generate Codabar Barcode
java.lang.Object
de.vwsoft.barcodelib4j.oned.Barcode
de.vwsoft.barcodelib4j.oned.LineageTwoWidth
de.vwsoft.barcodelib4j.oned.ImplCodabar
- All Implemented Interfaces:
Cloneable
Implementation of Codabar. To generate instances, please use one of the
newInstance
static methods in the Barcode
class.
Codabar is a 1D barcode symbology typically used in libraries, blood banks and transportation applications. It is capable of encoding digits (0-9) and the characters plus (+), minus (-), dollar ($), colon (:), slash (/), and period (.), as well as the start/stop characters 'A', 'B', 'C' and 'D'.
The encoded data must begin and end with one of the above start/stop characters. These characters can be either different or the same.
-
Field Summary
Fields inherited from class de.vwsoft.barcodelib4j.oned.LineageTwoWidth
DEFAULT_RATIO
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setContent
(String content, boolean autoComplete, boolean appendOptionalChecksum) Sets the content to be encoded in the barcode.Methods inherited from class de.vwsoft.barcodelib4j.oned.LineageTwoWidth
getRatio, setRatio
Methods inherited from class de.vwsoft.barcodelib4j.oned.Barcode
clone, draw, draw, draw, getAddOn, getContent, getFont, getText, getTextOffset, isFontSizeAdjusted, isOptionalChecksumVisible, isTextOnTop, isTextVisible, newInstance, newInstance, setAddOn, setCustomText, setFont, setFontSizeAdjusted, setOptionalChecksumVisible, setTextOffset, setTextOnTop, setTextVisible, supportsAddOn, supportsAutoCompletion, supportsCustomText, supportsOptionalChecksum, supportsTextOnTop
-
Method Details
-
setContent
public void setContent(String content, boolean autoComplete, boolean appendOptionalChecksum) throws BarcodeException Sets the content to be encoded in the barcode.Validates the provided content and ensures that it begins and ends with a valid start/stop character ('A', 'B', 'C' or 'D'). If
autoComplete
is set totrue
, the method will automatically add 'A' as the start and stop character if one or both are missing.- Specified by:
setContent
in classBarcode
- Parameters:
content
- the content to be encoded in the Codabar barcodeautoComplete
- whether to automatically add start and stop characters if they are missingappendOptionalChecksum
- has no function, as Codabar does not support checksums- Throws:
BarcodeException
- if the content is empty, invalid, or missing required start/stop characters
-