barcode4j 2.1.0

org.krysalis.barcode4j.impl.code39
Class Code39LogicImpl

java.lang.Object
  extended by org.krysalis.barcode4j.impl.code39.Code39LogicImpl

public class Code39LogicImpl
extends java.lang.Object

This class is an implementation of the Code39 barcode.

Version:
$Id: Code39LogicImpl.java,v 1.5 2009/02/20 09:33:43 jmaerki Exp $
Author:
Jeremias Maerki
TODO:
Add ASCII-7bit encoding table

Constructor Summary
Code39LogicImpl(ChecksumMode mode, boolean displayStartStop, boolean displayChecksum, boolean extendedCharSet)
          Main constructor
 
Method Summary
static char calcChecksum(java.lang.String msg)
          Calculates the checksum for a message to be encoded as an Code39 barcode.
protected  void encodeChar(ClassicBarcodeLogicHandler logic, char c)
          Encodes a single character.
static java.lang.StringBuffer escapeExtended(java.lang.String msg, java.lang.StringBuffer sb)
          Escapes US-ASCII characters as required for the extended character set for Code 39.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic
 ChecksumMode getChecksumMode()
          Returns the currently active checksum mode.
static boolean validateChecksum(java.lang.String msg)
          Verifies the checksum for a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Code39LogicImpl

public Code39LogicImpl(ChecksumMode mode,
                       boolean displayStartStop,
                       boolean displayChecksum,
                       boolean extendedCharSet)
Main constructor

Parameters:
mode - checksum mode
displayStartStop - Controls whether to display start and stop characters in the human-readable message
displayChecksum - Controls whether to display checksum in the human-readable message
Method Detail

getChecksumMode

public ChecksumMode getChecksumMode()
Returns the currently active checksum mode.

Returns:
the checksum mode

escapeExtended

public static java.lang.StringBuffer escapeExtended(java.lang.String msg,
                                                    java.lang.StringBuffer sb)
Escapes US-ASCII characters as required for the extended character set for Code 39.

Parameters:
msg - the original message
sb - the StringBuffer to write the escaped message to (or null)
Returns:
a StringBuffer containing the escaped message

calcChecksum

public static char calcChecksum(java.lang.String msg)
Calculates the checksum for a message to be encoded as an Code39 barcode.

Parameters:
msg - message to calculate the check digit for
Returns:
char the check digit

validateChecksum

public static boolean validateChecksum(java.lang.String msg)
Verifies the checksum for a message.

Parameters:
msg - message (check digit included)
Returns:
boolean True, if the checksum is correct

encodeChar

protected void encodeChar(ClassicBarcodeLogicHandler logic,
                          char c)
Encodes a single character.

Parameters:
logic - the logic handler to receive generated events
c - the character to encode

generateBarcodeLogic

public void generateBarcodeLogic(ClassicBarcodeLogicHandler logic,
                                 java.lang.String msg)
Generates the barcode logic

Parameters:
logic - the logic handler to receive generated events
msg - the message to encode

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.