Class PDF417HighLevelEncoder
java.lang.Object
org.krysalis.barcode4j.impl.pdf417.PDF417HighLevelEncoder
- All Implemented Interfaces:
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 $
-
Field Summary
Fields inherited from interface org.krysalis.barcode4j.impl.pdf417.PDF417Constants
BYTE_COMPACTION, CODEWORD_TABLE, CP437, DEFAULT_ENCODING, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intdetermineConsecutiveBinaryCount(String msg, byte[] bytes, int startpos) Determines the number of consecutive characters that are encodable using binary compaction.static intdetermineConsecutiveDigitCount(String msg, int startpos) Determines the number of consecutive characters that are encodable using numeric compaction.static intdetermineConsecutiveTextCount(String msg, int startpos) Determines the number of consecutive characters that are encodable using text compaction.static voidencodeBinary(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.static StringencodeHighLevel(byte[] data) Performs high-level encoding of a PDF417 message (binary data).static StringencodeHighLevel(String msg) Performs high-level encoding of a PDF417 message using the algorithm described in annex P of ISO/IEC 15438:2001(E).static StringencodeHighLevel(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).static voidencodeNumeric(String msg, int startpos, int count, StringBuffer sb) static intencodeText(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.
-
Constructor Details
-
PDF417HighLevelEncoder
public PDF417HighLevelEncoder()
-
-
Method Details
-
encodeHighLevel
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
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
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 messagestartpos- the start position within the messagecount- the number of characters to encodesb- receives the encoded codewordsinitialSubmode- 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 messagebytes- the message converted to a byte arraystartpos- the start position within the messagecount- the number of bytes to encodestartmode- the mode from which this method startssb- receives the encoded codewords
-
encodeNumeric
-
determineConsecutiveDigitCount
Determines the number of consecutive characters that are encodable using numeric compaction.- Parameters:
msg- the messagestartpos- the start position within the message- Returns:
- the requested character count
-
determineConsecutiveTextCount
Determines the number of consecutive characters that are encodable using text compaction.- Parameters:
msg- the messagestartpos- the start position within the message- Returns:
- the requested character count
-
determineConsecutiveBinaryCount
Determines the number of consecutive characters that are encodable using binary compaction.- Parameters:
msg- the messagebytes- the message converted to a byte arraystartpos- the start position within the message- Returns:
- the requested character count
-