Barcode-Lib4J requires Java 9+
Package de.vwsoft.barcodelib4j.oned
Java Class «ImplCode128» – Generate Code 128 Barcode
java.lang.Object
de.vwsoft.barcodelib4j.oned.Barcode
de.vwsoft.barcodelib4j.oned.ImplCode128
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ImplCode128A
,ImplCode128B
,ImplCode128C
,ImplEAN128
Implementation of Code 128. To generate instances, please use one of the
newInstance
static methods in the Barcode
class.
Code 128 is a widely used high-density barcode symbology that encodes all 128 ASCII characters, covering:
- Control characters (ASCII 0-31), such as NUL, SOH, STX, etc.
- Digits (0-9)
- Upper and lower case letters (A-Z, a-z)
- Space character
- Punctuation and special characters:
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
Code 128 uses an internal checksum included within the barcode symbol but not displayed in plaintext representation.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
Character constant that can be used as a marker for FNC1 in the input.static final char
Character constant that can be used as a marker for FNC2 in the input.static final char
Character constant that can be used as a marker for FNC3 in the input.static final char
Character constant that can be used as a marker for FNC4 in the input. -
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.Barcode
clone, draw, draw, draw, getAddOn, getContent, getFont, getRatio, getText, getTextOffset, isFontSizeAdjusted, isOptionalChecksumVisible, isTextOnTop, isTextVisible, newInstance, newInstance, setAddOn, setCustomText, setFont, setFontSizeAdjusted, setOptionalChecksumVisible, setRatio, setTextOffset, setTextOnTop, setTextVisible, supportsAddOn, supportsCustomText, supportsOptionalChecksum, supportsRatio, supportsTextOnTop
-
Field Details
-
FNC1
public static final char FNC1Character constant that can be used as a marker for FNC1 in the input. -
FNC2
public static final char FNC2Character constant that can be used as a marker for FNC2 in the input. -
FNC3
public static final char FNC3Character constant that can be used as a marker for FNC3 in the input. -
FNC4
public static final char FNC4Character constant that can be used as a marker for FNC4 in the input.
-
-
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 to ensure that it contains only ASCII characters, and throws a
BarcodeException
if it does not.The provided content can also include Function Codes
FNC1
toFNC4
for specific application needs.- Specified by:
setContent
in classBarcode
- Parameters:
content
- the content to be encoded in the Code 128 barcodeautoComplete
- has no function in this method implementationappendOptionalChecksum
- has no function, as Code 128 uses a fixed internal checksum which is not optional- Throws:
BarcodeException
- if the content is empty, or contains non-ASCII characters
-