Class ECIEncoderSet


  • public final class ECIEncoderSet
    extends java.lang.Object
    Set of CharsetEncoders for a given input string Invariants: - The list contains only encoders from CharacterSetECI (list is shorter then the list of encoders available on the platform for which ECI values are defined). - The list contains encoders at least one encoder for every character in the input. - The first encoder in the list is always the ISO-8859-1 encoder even of no character in the input can be encoded by it. - If the input contains a character that is not in ISO-8859-1 then the last two entries in the list will be the UTF-8 encoder and the UTF-16BE encoder.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.charset.CharsetEncoder[] encoders  
      private static java.util.List<java.nio.charset.CharsetEncoder> ENCODERS  
      private int priorityEncoderIndex  
    • Constructor Summary

      Constructors 
      Constructor Description
      ECIEncoderSet​(java.lang.String stringToEncode, java.nio.charset.Charset priorityCharset, int fnc1)
      Constructs an encoder set
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canEncode​(char c, int encoderIndex)  
      byte[] encode​(char c, int encoderIndex)  
      byte[] encode​(java.lang.String s, int encoderIndex)  
      java.nio.charset.Charset getCharset​(int index)  
      java.lang.String getCharsetName​(int index)  
      int getECIValue​(int encoderIndex)  
      int getPriorityEncoderIndex()  
      int length()  
      • Methods inherited from class java.lang.Object

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

      • ENCODERS

        private static final java.util.List<java.nio.charset.CharsetEncoder> ENCODERS
      • encoders

        private final java.nio.charset.CharsetEncoder[] encoders
      • priorityEncoderIndex

        private final int priorityEncoderIndex
    • Constructor Detail

      • ECIEncoderSet

        public ECIEncoderSet​(java.lang.String stringToEncode,
                             java.nio.charset.Charset priorityCharset,
                             int fnc1)
        Constructs an encoder set
        Parameters:
        stringToEncode - the string that needs to be encoded
        priorityCharset - The preferred Charset or null.
        fnc1 - fnc1 denotes the character in the input that represents the FNC1 character or -1 for a non-GS1 bar code. When specified, it is considered an error to pass it as argument to the methods canEncode() or encode().
    • Method Detail

      • length

        public int length()
      • getCharsetName

        public java.lang.String getCharsetName​(int index)
      • getCharset

        public java.nio.charset.Charset getCharset​(int index)
      • getECIValue

        public int getECIValue​(int encoderIndex)
      • getPriorityEncoderIndex

        public int getPriorityEncoderIndex()
      • canEncode

        public boolean canEncode​(char c,
                                 int encoderIndex)
      • encode

        public byte[] encode​(char c,
                             int encoderIndex)
      • encode

        public byte[] encode​(java.lang.String s,
                             int encoderIndex)