Barcode-Lib4J requires Java 9+

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

public class ImplCode128 extends Barcode
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: !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
In addition, Function Codes (FNC1 to FNC4) can be used within the provided input to meet specific application requirements.

Code 128 uses an internal checksum included within the barcode symbol but not displayed in plaintext representation.

  • Field Details

    • FNC1

      public static final char FNC1
      Character constant that can be used as a marker for FNC1 in the input.
    • FNC2

      public static final char FNC2
      Character constant that can be used as a marker for FNC2 in the input.
    • FNC3

      public static final char FNC3
      Character constant that can be used as a marker for FNC3 in the input.
    • FNC4

      public static final char FNC4
      Character 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 to FNC4 for specific application needs.

      Specified by:
      setContent in class Barcode
      Parameters:
      content - the content to be encoded in the Code 128 barcode
      autoComplete - has no function in this method implementation
      appendOptionalChecksum - 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