barcode4j 2.1.0

org.krysalis.barcode4j.impl.code128
Class Code128LogicImpl

java.lang.Object
  extended by org.krysalis.barcode4j.impl.code128.Code128LogicImpl

public class Code128LogicImpl
extends java.lang.Object

This class is an implementation of the Code 128 barcode.

Version:
$Id: Code128LogicImpl.java,v 1.5 2009/02/20 13:07:21 jmaerki Exp $

Field Summary
static char FNC_1
          The function 1 command.
static char FNC_2
          The function 2 command.
static char FNC_3
          The function 3 command.
static char FNC_4
          The function 4 command.
 
Constructor Summary
Code128LogicImpl()
          Default constructor.
Code128LogicImpl(int codeset)
          Main constructor.
 
Method Summary
static boolean canBeInCodeSetC(char ch, boolean second)
          Determines whether a character is a digit or a function 1 command.
protected  void encodeChar(ClassicBarcodeLogicHandler logic, int index)
          Encodes a character.
protected  void encodeStop(ClassicBarcodeLogicHandler logic)
          Encodes the special stop character.
 void generateBarcodeLogic(ClassicBarcodeLogicHandler logic, java.lang.String msg)
          Generates the barcode logic
protected  Code128Encoder getEncoder()
          Returns the encoder to be used.
static boolean isInCodeSetA(char ch)
          Determines whether a character is defined in codeset A.
static boolean isInCodeSetB(char ch)
          Determines whether a character is defined in codeset B.
static boolean isValidChar(char ch)
          Determines whether a character can be encoded in Code 128.
static java.lang.String symbolCharToString(int index)
          Converts a character set index to a String representation.
static java.lang.String toString(int[] encodedMsg)
          Converts an encoded Code 128 message into a String for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FNC_1

public static final char FNC_1
The function 1 command. ASCII: 0xF1

See Also:
Constant Field Values

FNC_2

public static final char FNC_2
The function 2 command. ASCII: 0xF2

See Also:
Constant Field Values

FNC_3

public static final char FNC_3
The function 3 command. ASCII: 0xF3

See Also:
Constant Field Values

FNC_4

public static final char FNC_4
The function 4 command. ASCII: 0xF4

See Also:
Constant Field Values
Constructor Detail

Code128LogicImpl

public Code128LogicImpl()
Default constructor.


Code128LogicImpl

public Code128LogicImpl(int codeset)
Main constructor.

Parameters:
codeset - the enabled codeset
Method Detail

isValidChar

public static boolean isValidChar(char ch)
Determines whether a character can be encoded in Code 128.

Parameters:
ch - the character to check
Returns:
true if it is a valid character

isInCodeSetA

public static boolean isInCodeSetA(char ch)
Determines whether a character is defined in codeset A.

Parameters:
ch - the character to check
Returns:
true if it is found in codeset A

isInCodeSetB

public static boolean isInCodeSetB(char ch)
Determines whether a character is defined in codeset B.

Parameters:
ch - the character to check
Returns:
true if it is found in codeset B

canBeInCodeSetC

public static boolean canBeInCodeSetC(char ch,
                                      boolean second)
Determines whether a character is a digit or a function 1 command.

Parameters:
ch - the character to check
second - true if checking the character for the second position in a duo.
Returns:
true if the above condition is met

symbolCharToString

public static java.lang.String symbolCharToString(int index)
Converts a character set index to a String representation. This is primarily used for debugging purposes.

Parameters:
index - the character set index
Returns:
the String representation

toString

public static java.lang.String toString(int[] encodedMsg)
Converts an encoded Code 128 message into a String for debugging purposes.

Parameters:
encodedMsg - the encoded message
Returns:
the String representation

encodeChar

protected void encodeChar(ClassicBarcodeLogicHandler logic,
                          int index)
Encodes a character.

Parameters:
logic - LogicHandler to send the barcode events to
index - index withing the character set of the character to encode

encodeStop

protected void encodeStop(ClassicBarcodeLogicHandler logic)
Encodes the special stop character.

Parameters:
logic - LogicHandler to send the barcode events to

getEncoder

protected Code128Encoder getEncoder()
Returns the encoder to be used. The encoder is responsible for turning a String message into an array of character set indexes.

Override this method to supply your own implementation.

Returns:
the requested encoder

generateBarcodeLogic

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

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

barcode4j 2.1.0

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