Class PDF417HighLevelEncoder

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

public class PDF417HighLevelEncoder extends 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.10 2012-05-17 13:57:37 jmaerki Exp $
  • Constructor Details

    • PDF417HighLevelEncoder

      public PDF417HighLevelEncoder()
  • Method Details

    • encodeHighLevel

      public static 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 String encodeHighLevel(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)
    • encodeHighLevel

      public static String encodeHighLevel(String msg, String encoding, boolean enableECI)
      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(String msg, int startpos, int count, 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(String msg, byte[] bytes, int startpos, int count, int startmode, 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(String msg, int startpos, int count, StringBuffer sb)
    • determineConsecutiveDigitCount

      public static int determineConsecutiveDigitCount(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(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(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