public enum DotCodeEncodeMode extends java.lang.Enum<DotCodeEncodeMode>
Encoding mode for DotCode barcodes.
//Auto mode with macros String codetext = ""[)>05CodetextWithMacros05""; BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DOT_CODE, codetext); { generator.save("test.bmp"); } //Auto mode String codetext = "犬Right狗"; BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DOT_CODE, codetext); { generator.getParameters().getBarcode().getDotCode().setECIEncoding(ECIEncodings.UTF8); generator.save("test.bmp"); } //Bytes mode byte[] encodedArr = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9 }; //encode array to string StringBuilder strBld = new StringBuilder(); for (byte bval : encodedArr) strBld.append((char) bval); String codetext = strBld.ToString(); BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DOT_CODE, codetext); { generator.getParameters().getBarcode().getDotCode().setDotCodeEncodeMode(DotCodeEncodeMode.BYTES); generator.save("test.bmp"); } //Extended codetext mode //create codetext DotCodeExtCodetextBuilder textBuilder = new DotCodeExtCodetextBuilder(); textBuilder.addFNC1FormatIdentifier(); textBuilder.addECICodetext(ECIEncodings.Win1251, "Will"); textBuilder.addFNC1FormatIdentifier(); textBuilder.addECICodetext(ECIEncodings.UTF8, "犬Right狗"); textBuilder.addFNC3SymbolSeparator(); textBuilder.addFNC1FormatIdentifier(); textBuilder.addECICodetext(ECIEncodings.UTF16BE, "犬Power狗"); textBuilder.addPlainCodetext("Plain text"); //generate codetext String codetext = textBuilder.getExtendedCodetext(); //generate BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DOT_CODE, codetext); { generator.getParameters().getBarcode().getDotCode().setDotCodeEncodeMode(DotCodeEncodeMode.EXTENDED_CODETEXT); generator.save("test.bmp"); }
Enum Constant and Description |
---|
AUTO
Encode codetext with value set in the ECIEncoding property.
|
BYTES
Encode codetext as plain bytes.
|
EXTENDED_CODETEXT |
Modifier and Type | Method and Description |
---|---|
int |
getValue() |
static DotCodeEncodeMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DotCodeEncodeMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DotCodeEncodeMode AUTO
Encode codetext with value set in the ECIEncoding property.
public static final DotCodeEncodeMode BYTES
Encode codetext as plain bytes. If it detects any Unicode character, the character will be encoded as two bytes, lower byte first.
public static final DotCodeEncodeMode EXTENDED_CODETEXT
Extended mode which supports multi ECI modes.
It is better to use DotCodeExtCodetextBuilder for extended codetext generation.
Use Display2DText property to set visible text to removing managing characters.
ECI identifiers are set as single slash and six digits identifier "\000026" - UTF8 ECI identifier
All unicode characters after ECI identifier are automatically encoded into correct character codeset.
public static DotCodeEncodeMode[] values()
for (DotCodeEncodeMode c : DotCodeEncodeMode.values()) System.out.println(c);
public static DotCodeEncodeMode valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getValue()