public enum MaxiCodeEncodeMode extends java.lang.Enum<MaxiCodeEncodeMode>
//Auto mode
String codetext = "犬Right狗";
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.MAXI_CODE, codetext);
{
generator.getParameters().getBarcode().getMaxiCode().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 generator1 = new BarcodeGenerator(EncodeTypes.MAXI_CODE, codetext);
generator.getParameters().getBarcode().getMaxiCode().setMaxiCodeEncodeMode(MaxiCodeEncodeMode.BYTES);
generator.save("test.bmp");
//Extended codetext mode
//create codetext
MaxiCodeExtCodetextBuilder textBuilder = new MaxiCodeExtCodetextBuilder();
textBuilder.addECICodetext(ECIEncodings.Win1251, "Will");
textBuilder.addECICodetext(ECIEncodings.UTF8, "犬Right狗");
textBuilder.addECICodetext(ECIEncodings.UTF16BE, "犬Power狗");
textBuilder.addPlainCodetext("Plain text");
// generate codetext
String codetext = textBuilder.getExtendedCodetext();
//generate
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.MaxiCode, codetext);
generator.getParameters().getBarcode().getMaxiCode().setMaxiCodeEncodeMode(MaxiCodeEncodeMode.EXTENDED_CODETEXT);
generator.getParameters().getBarcode().getMaxiCode().setTwoDDisplayText("My Text");
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
Extended mode which supports multi ECI modes.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getValue() |
static MaxiCodeEncodeMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static MaxiCodeEncodeMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MaxiCodeEncodeMode AUTO
public static final MaxiCodeEncodeMode BYTES
public static final MaxiCodeEncodeMode EXTENDED_CODETEXT
public static MaxiCodeEncodeMode[] values()
for (MaxiCodeEncodeMode c : MaxiCodeEncodeMode.values()) System.out.println(c);
public static MaxiCodeEncodeMode 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()