Barcode-Lib4J requires Java 9+

Java Class «ImplCode128B»  –  Generate Code 128 B Barcode

All Implemented Interfaces:
Cloneable

public class ImplCode128B extends ImplCode128
Implementation of Code 128 B. To generate instances, please use one of the newInstance static methods in the Barcode class.

Code 128 B is a subset of Code 128, capable of encoding ASCII characters with values from 32 to 127, covering:

  • Upper and lower case letters (A-Z, a-z)
  • Digits (0-9)
  • 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 B uses an internal checksum included within the barcode symbol but not displayed in plaintext representation.

  • 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 with values between 32 and 127, and throws a BarcodeException if it does not.

      The provided content can also include Function Codes FNC1 to FNC4 for specific application needs.

      Overrides:
      setContent in class ImplCode128
      Parameters:
      content - the content to be encoded in the Code 128 B barcode
      autoComplete - has no function in this method implementation
      appendOptionalChecksum - has no function, as Code 128 B uses a fixed internal checksum which is not optional
      Throws:
      BarcodeException - if the content is empty, or contains characters outside ASCII range 32-127