barcode4j 2.1.0

org.krysalis.barcode4j.impl.pdf417
Class PDF417HighLevelEncoder

java.lang.Object
  extended by org.krysalis.barcode4j.impl.pdf417.PDF417HighLevelEncoder
All Implemented Interfaces:
PDF417Constants

public class PDF417HighLevelEncoder
extends java.lang.Object
implements PDF417Constants

PDF417 high-level encoder following the algorithm described in ISO/IEC 15438:2001(E) in annex P.

Version:
$Id: PDF417HighLevelEncoder.java,v 1.9 2011/10/15 13:37:18 jmaerki Exp $

Field Summary
 
Fields inherited from interface org.krysalis.barcode4j.impl.pdf417.PDF417Constants
BYTE_COMPACTION, CODEWORD_TABLE, EC_COEFFICIENTS, ECI_CHARSET, ECI_GENERAL_PURPOSE, ECI_USER_DEFINED, LATCH_TO_BYTE, LATCH_TO_BYTE_PADDED, LATCH_TO_NUMERIC, LATCH_TO_TEXT, MACRO_PDF_CONTROL_BLOCK_START, MACRO_PDF_OPTIONAL_FIELD_START, MACRO_PDF_TERMINATOR, NUMERIC_COMPACTION, PAD, READER_INITIALISATION, SHIFT_TO_BYTE, START_PATTERN, STOP_PATTERN, SUBMODE_ALPHA, SUBMODE_LOWER, SUBMODE_MIXED, SUBMODE_PUNCTUATION, TEXT_COMPACTION, TEXT_MIXED_RAW, TEXT_PUNCTUATION_RAW
 
Constructor Summary
PDF417HighLevelEncoder()
           
 
Method Summary
static int determineConsecutiveBinaryCount(java.lang.String msg, byte[] bytes, int startpos)
          Determines the number of consecutive characters that are encodable using binary compaction.
static int determineConsecutiveDigitCount(java.lang.String msg, int startpos)
          Determines the number of consecutive characters that are encodable using numeric compaction.
static int determineConsecutiveTextCount(java.lang.String msg, int startpos)
          Determines the number of consecutive characters that are encodable using text compaction.
static void encodeBinary(java.lang.String msg, byte[] bytes, int startpos, int count, int startmode, java.lang.StringBuffer sb)
          Encode parts of the message using Byte Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.3.
static java.lang.String encodeHighLevel(byte[] data)
          Performs high-level encoding of a PDF417 message (binary data).
static java.lang.String encodeHighLevel(java.lang.String msg)
          Performs high-level encoding of a PDF417 message using the algorithm described in annex P of ISO/IEC 15438:2001(E).
static void encodeNumeric(java.lang.String msg, int startpos, int count, java.lang.StringBuffer sb)
           
static int encodeText(java.lang.String msg, int startpos, int count, java.lang.StringBuffer sb, int initialSubmode)
          Encode parts of the message using Text Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.2.
static byte[] getBytesForMessage(java.lang.String msg)
          Converts the message to a byte array using the default encoding (cp437) as defined by the specification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDF417HighLevelEncoder

public PDF417HighLevelEncoder()
Method Detail

getBytesForMessage

public static byte[] getBytesForMessage(java.lang.String msg)
Converts the message to a byte array using the default encoding (cp437) as defined by the specification

Parameters:
msg - the message
Returns:
the byte array of the message

encodeHighLevel

public static java.lang.String encodeHighLevel(byte[] data)
Performs high-level encoding of a PDF417 message (binary data).

Parameters:
data - the binary data stream
Returns:
the encoded message (the char values range from 0 to 928)

encodeHighLevel

public static java.lang.String encodeHighLevel(java.lang.String msg)
Performs high-level encoding of a PDF417 message using the algorithm described in annex P of ISO/IEC 15438:2001(E).

Parameters:
msg - the message
Returns:
the encoded message (the char values range from 0 to 928)

encodeText

public static int encodeText(java.lang.String msg,
                             int startpos,
                             int count,
                             java.lang.StringBuffer sb,
                             int initialSubmode)
Encode parts of the message using Text Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.2.

Parameters:
msg - the message
startpos - the start position within the message
count - the number of characters to encode
sb - receives the encoded codewords
initialSubmode - should normally be SUBMODE_ALPHA
Returns:
the text submode in which this method ends

encodeBinary

public static void encodeBinary(java.lang.String msg,
                                byte[] bytes,
                                int startpos,
                                int count,
                                int startmode,
                                java.lang.StringBuffer sb)
Encode parts of the message using Byte Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.3. The Unicode characters will be converted to binary using the cp437 codepage.

Parameters:
msg - the message
bytes - the message converted to a byte array
startpos - the start position within the message
count - the number of bytes to encode
startmode - the mode from which this method starts
sb - receives the encoded codewords

encodeNumeric

public static void encodeNumeric(java.lang.String msg,
                                 int startpos,
                                 int count,
                                 java.lang.StringBuffer sb)

determineConsecutiveDigitCount

public static int determineConsecutiveDigitCount(java.lang.String msg,
                                                 int startpos)
Determines the number of consecutive characters that are encodable using numeric compaction.

Parameters:
msg - the message
startpos - the start position within the message
Returns:
the requested character count

determineConsecutiveTextCount

public static int determineConsecutiveTextCount(java.lang.String msg,
                                                int startpos)
Determines the number of consecutive characters that are encodable using text compaction.

Parameters:
msg - the message
startpos - the start position within the message
Returns:
the requested character count

determineConsecutiveBinaryCount

public static int determineConsecutiveBinaryCount(java.lang.String msg,
                                                  byte[] bytes,
                                                  int startpos)
Determines the number of consecutive characters that are encodable using binary compaction.

Parameters:
msg - the message
bytes - the message converted to a byte array
startpos - the start position within the message
Returns:
the requested character count

barcode4j 2.1.0

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