Enum Class HanXinEncodeMode

java.lang.Object
java.lang.Enum<HanXinEncodeMode>
com.aspose.barcode.generation.HanXinEncodeMode
All Implemented Interfaces:
Serializable, Comparable<HanXinEncodeMode>, Constable

public enum HanXinEncodeMode extends Enum<HanXinEncodeMode>

Han Xin Code encoding mode. It is recommended to use Auto with ASCII / Chinese characters or Unicode for Unicode characters.


  
  // Auto mode
  String codetext = "1234567890ABCDEFGabcdefg,Han Xin Code";
  BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HAN_XIN, codetext);
  generator.save("test.bmp");


 // Binary mode
 byte[] encodedArr = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9 };
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HAN_XIN)
 generator.setCodeText(encodedArr);
 generator.getParameters().getBarcode().getHanXin().setHanXinEncodeMode(HanXinEncodeMode.BINARY);
 generator.save("test.bmp");

  // ECI mode
  String codetext = "ΑΒΓΔΕ";
  BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HAN_XIN, codetext);
  generator.getParameters().getBarcode().getHanXin().setHanXinEncodeMode(HanXinEncodeMode.ECI);
  generator.getParameters().getBarcode().getHanXin().setHanXinECIEncoding(ECIEncodings.ISO_8859_7);
  generator.save("test.bmp");

  // URI mode
  String codetext = "https://www.test.com/%BC%DE%%%ab/search=test";
  BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HAN_XIN, codetext);
  generator.getParameters().getBarcode().getHanXin().setEncodeMode(EncodeMode.URI);
  generator.save("test.bmp");


  // Extended mode
  String str = "\\gb180302b:漄\\gb180304b:㐁\\region1:全\\region2:螅\\numeric:123\\text:qwe\\\\unicode:ıntəˈnæʃənəl" +
      "\\000009:ΑΒΓΔΕ\\auto:abc\\binary:abc\\\\uri:backslashes_should_be_doubled\\\\000555:test";

  String expectedStr = "漄㐁全螅123qweıntəˈnæʃənəlΑΒΓΔΕabcabcbackslashes_should_be_doubled\\000555:test";

  BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HanXin, str);
  generator.getParameters().getBarcode().getHanXin().setEncodeMode(EncodeMode.EXTENDED);
  generator.save("test.bmp");

  // Using HanXinExtCodetextBuilder for Extended mode (same codetext as in previous example)
  //create codetext
  HanXinExtCodetextBuilder codeTextBuilder = new HanXinExtCodetextBuilder();
  codeTextBuilder.addGB18030TwoByte("漄");
  codeTextBuilder.addGB18030FourByte("㐁");
  codeTextBuilder.addCommonChineseRegionOne("全");
  codeTextBuilder.addCommonChineseRegionTwo("螅");
  codeTextBuilder.addNumeric("123");
  codeTextBuilder.addText("qwe");
  codeTextBuilder.addUnicode("ıntəˈnæʃənəl");
  codeTextBuilder.addECI("ΑΒΓΔΕ", 9);
  codeTextBuilder.addAuto("abc");
  codeTextBuilder.addBinary("abc");
  codeTextBuilder.addURI("backslashes_should_be_doubled\\000555:test");

  String expectedStr = "漄㐁全螅123qweıntəˈnæʃənəlΑΒΓΔΕabcabcbackslashes_should_be_doubled\\000555:test";

  //generate codetext
  String str = codeTextBuilder.getExtendedCodetext();

  //generate
  BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.HanXin, str);
  generator.getParameters().getBarcode().getHanXin().setEncodeMode(EncodeMode.EXTENDED);
  generator.save("test.bmp");
  

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    In Auto mode, the CodeText is encoded with maximum data compactness.
    In Binary mode, the CodeText is encoded with maximum data compactness.
    In ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier.
    Extended mode allow combinations of internal modes: Auto, Binary, Text, Numeric, URI, Unicode, ECI, Common Chinese Region One, Common Chinese Region Two, GB18030 Two Byte, GB18030 Four Byte.
    Unicode mode designs a way to represent any text data reference to UTF8 encoding/charset in Han Xin Code.
    URI mode indicates the data represented in Han Xin Code is Uniform Resource Identifier (URI) reference to RFC 3986.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • AUTO

      public static final HanXinEncodeMode AUTO

      In Auto mode, the CodeText is encoded with maximum data compactness. Unicode characters are encoded using GB18030 encoding according to HanXin barcode specification.

    • BINARY

      public static final HanXinEncodeMode BINARY

      In Binary mode, the CodeText is encoded with maximum data compactness. If a Unicode character is found, an exception is thrown.

    • ECI

      public static final HanXinEncodeMode ECI

      In ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier. If a character is found that is not supported by the selected ECI encoding, an exception is thrown. Please note that some old (pre 2006) scanners may not support this mode.

    • UNICODE

      public static final HanXinEncodeMode UNICODE

      Unicode mode designs a way to represent any text data reference to UTF8 encoding/charset in Han Xin Code.

    • URI

      public static final HanXinEncodeMode URI

      URI mode indicates the data represented in Han Xin Code is Uniform Resource Identifier (URI) reference to RFC 3986.

    • EXTENDED

      public static final HanXinEncodeMode EXTENDED

      Extended mode allow combinations of internal modes: Auto, Binary, Text, Numeric, URI, Unicode, ECI, Common Chinese Region One, Common Chinese Region Two, GB18030 Two Byte, GB18030 Four Byte. Codetext can be built manually with prefixes and doubled backslashes, e.g.: @"\auto:abc\000009:ΑΒΓΔΕ\auto:ab\\c" or using the HanXinExtCodetextBuilder. If the codetext contains an ECI fragment, then only the following modes can be in that codetext after ECI fragment: Auto, Binary, Text, Numeric, URI, ECI.

  • Method Details

    • values

      public static HanXinEncodeMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static HanXinEncodeMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public int getValue()