Class Encoder


  • public final class Encoder
    extends java.lang.Object
    Generates Aztec 2D barcodes.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Encoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int[] bitsToWords​(BitArray stuffedBits, int wordSize, int totalWords)  
      private static void drawBullsEye​(BitMatrix matrix, int center, int size)  
      private static void drawModeMessage​(BitMatrix matrix, boolean compact, int matrixSize, BitArray modeMessage)  
      static AztecCode encode​(byte[] data)
      Encodes the given binary content as an Aztec symbol (without ECI code)
      static AztecCode encode​(byte[] data, int minECCPercent, int userSpecifiedLayers)
      Encodes the given binary content as an Aztec symbol (without ECI code)
      static AztecCode encode​(byte[] data, int minECCPercent, int userSpecifiedLayers, java.nio.charset.Charset charset)
      Encodes the given binary content as an Aztec symbol
      static AztecCode encode​(java.lang.String data)
      Encodes the given string content as an Aztec symbol (without ECI code)
      static AztecCode encode​(java.lang.String data, int minECCPercent, int userSpecifiedLayers)
      Encodes the given string content as an Aztec symbol (without ECI code)
      static AztecCode encode​(java.lang.String data, int minECCPercent, int userSpecifiedLayers, java.nio.charset.Charset charset)
      Encodes the given string content as an Aztec symbol
      private static BitArray generateCheckWords​(BitArray bitArray, int totalBits, int wordSize)  
      (package private) static BitArray generateModeMessage​(boolean compact, int layers, int messageSizeInWords)  
      private static GenericGF getGF​(int wordSize)  
      (package private) static BitArray stuffBits​(BitArray bits, int wordSize)  
      private static int totalBitsInLayer​(int layers, boolean compact)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Encoder

        private Encoder()
    • Method Detail

      • encode

        public static AztecCode encode​(java.lang.String data)
        Encodes the given string content as an Aztec symbol (without ECI code)
        Parameters:
        data - input data string; must be encodable as ISO/IEC 8859-1 (Latin-1)
        Returns:
        Aztec symbol matrix with metadata
      • encode

        public static AztecCode encode​(java.lang.String data,
                                       int minECCPercent,
                                       int userSpecifiedLayers)
        Encodes the given string content as an Aztec symbol (without ECI code)
        Parameters:
        data - input data string; must be encodable as ISO/IEC 8859-1 (Latin-1)
        minECCPercent - minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended)
        userSpecifiedLayers - if non-zero, a user-specified value for the number of layers
        Returns:
        Aztec symbol matrix with metadata
      • encode

        public static AztecCode encode​(java.lang.String data,
                                       int minECCPercent,
                                       int userSpecifiedLayers,
                                       java.nio.charset.Charset charset)
        Encodes the given string content as an Aztec symbol
        Parameters:
        data - input data string
        minECCPercent - minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended)
        userSpecifiedLayers - if non-zero, a user-specified value for the number of layers
        charset - character set in which to encode string using ECI; if null, no ECI code will be inserted, and the string must be encodable as ISO/IEC 8859-1 (Latin-1), the default encoding of the symbol.
        Returns:
        Aztec symbol matrix with metadata
      • encode

        public static AztecCode encode​(byte[] data)
        Encodes the given binary content as an Aztec symbol (without ECI code)
        Parameters:
        data - input data string
        Returns:
        Aztec symbol matrix with metadata
      • encode

        public static AztecCode encode​(byte[] data,
                                       int minECCPercent,
                                       int userSpecifiedLayers)
        Encodes the given binary content as an Aztec symbol (without ECI code)
        Parameters:
        data - input data string
        minECCPercent - minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended)
        userSpecifiedLayers - if non-zero, a user-specified value for the number of layers
        Returns:
        Aztec symbol matrix with metadata
      • encode

        public static AztecCode encode​(byte[] data,
                                       int minECCPercent,
                                       int userSpecifiedLayers,
                                       java.nio.charset.Charset charset)
        Encodes the given binary content as an Aztec symbol
        Parameters:
        data - input data string
        minECCPercent - minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended)
        userSpecifiedLayers - if non-zero, a user-specified value for the number of layers
        charset - character set to mark using ECI; if null, no ECI code will be inserted, and the default encoding of ISO/IEC 8859-1 will be assuming by readers.
        Returns:
        Aztec symbol matrix with metadata
      • drawBullsEye

        private static void drawBullsEye​(BitMatrix matrix,
                                         int center,
                                         int size)
      • generateModeMessage

        static BitArray generateModeMessage​(boolean compact,
                                            int layers,
                                            int messageSizeInWords)
      • drawModeMessage

        private static void drawModeMessage​(BitMatrix matrix,
                                            boolean compact,
                                            int matrixSize,
                                            BitArray modeMessage)
      • generateCheckWords

        private static BitArray generateCheckWords​(BitArray bitArray,
                                                   int totalBits,
                                                   int wordSize)
      • bitsToWords

        private static int[] bitsToWords​(BitArray stuffedBits,
                                         int wordSize,
                                         int totalWords)
      • getGF

        private static GenericGF getGF​(int wordSize)
      • totalBitsInLayer

        private static int totalBitsInLayer​(int layers,
                                            boolean compact)