MaxiCodeCodetextMode2

Inheritance: java.lang.Object, com.aspose.barcode.complexbarcode.MaxiCodeCodetext, com.aspose.barcode.complexbarcode.MaxiCodeStructuredCodetext

public class MaxiCodeCodetextMode2 extends MaxiCodeStructuredCodetext

Class for encoding and decoding the text embedded in the MaxiCode code for modes 2. This sample shows how to encode and decode MaxiCode codetext for mode 2.

//Mode 2 with standart second message
  MaxiCodeCodetextMode2 maxiCodeCodetext = new MaxiCodeCodetextMode2();
  maxiCodeCodetext.setPostalCode("524032140");
  maxiCodeCodetext.setCountryCode(056);
  maxiCodeCodetext.setServiceCategory(999);
  MaxiCodeStandartSecondMessage maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
  maxiCodeStandartSecondMessage.setMessage("Test message");
  maxiCodeCodetext.setSecondMessage(maxiCodeStandartSecondMessage);
  ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
  complexGenerator.generateBarCodeImage();
  
  //Mode 2 with structured second message
  MaxiCodeCodetextMode2 maxiCodeCodetext = new MaxiCodeCodetextMode2();
  maxiCodeCodetext.setPostalCode("524032140");
  maxiCodeCodetext.setCountryCode(056);
  maxiCodeCodetext.setServiceCategory(999);
  MaxiCodeStructuredSecondMessage maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
  maxiCodeStructuredSecondMessage.add("634 ALPHA DRIVE");
  maxiCodeStructuredSecondMessage.add("PITTSBURGH");
  maxiCodeStructuredSecondMessage.add("PA");
  maxiCodeStructuredSecondMessage.setYear(99);
  maxiCodeCodetext.setSecondMessage(maxiCodeStructuredSecondMessage);
  ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext);
  complexGenerator.generateBarCodeImage();
  
  //Decoding raw codetext with standart second message
  BarCodeReader reader = new BarCodeReader("test.png", DecodeType.MAXI_CODE);
  {
       for (BarCodeResult result : reader.readBarCodes())
      {
          MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
          if (resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2)
          {
              MaxiCodeCodetextMode2 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode2)resultMaxiCodeCodetext;
              System.out.println("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
              System.out.println("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
              System.out.println("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
              if (maxiCodeStructuredCodetext.getSecondMessage() instanceof MaxiCodeStandartSecondMessage){
                  MaxiCodeStandartSecondMessage secondMessage = (MaxiCodeStandartSecondMessage)maxiCodeStructuredCodetext.getSecondMessage();
                  System.out.println("Message: " + secondMessage.getMessage());
              }
          }
      }
  }
  //Decoding raw codetext with structured second message
  BarCodeReader reader = new BarCodeReader("test.png", DecodeType.MAXI_CODE);
  {
       for(BarCodeResult result : reader.readBarCodes())
      {
          MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.tryDecodeMaxiCode(result.getExtended().getMaxiCode().getMaxiCodeMode(), result.getCodeText());
          if (resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2){
              MaxiCodeCodetextMode2 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode2)resultMaxiCodeCodetext;
              System.out.println("BarCode Type: " + maxiCodeStructuredCodetext.getPostalCode());
              System.out.println("MaxiCode mode: " + maxiCodeStructuredCodetext.getCountryCode());
              System.out.println("BarCode CodeText: " + maxiCodeStructuredCodetext.getServiceCategory());
              if (maxiCodeStructuredCodetext.getSecondMessage() instanceof MaxiCodeStructuredSecondMessage){
                  MaxiCodeStructuredSecondMessage secondMessage = (MaxiCodeStructuredSecondMessage)maxiCodeStructuredCodetext.getSecondMessage();
                  System.out.println("Message:");
                  for (String identifier : secondMessage.getIdentifiers()){
                      System.out.println(identifier);
                  }
              }
          }
      }
  }

Constructors

ConstructorDescription
MaxiCodeCodetextMode2()

Methods

MethodDescription
equals(Object obj)Returns a value indicating whether this instance is equal to a specified MaxiCodeStructuredCodetext value.
getBarcodeType()Gets barcode type.
getClass()
getConstructedCodetext()Constructs codetext
getCountryCode()Identifies 3 digit country code.
getECIEncoding()Gets ECI encoding.
getHashCode()Returns the hash code for this instance.
getMaxiCodeEncodeMode()Gets a MaxiCode encode mode.
getMode()Gets MaxiCode mode.
getPostalCode()Identifies the postal code.
getSecondMessage()Identifies second message of the barcode.
getServiceCategory()Identifies 3 digit service category.
hashCode()
initFromString(String constructedCodetext)Initializes instance from constructed codetext.
notify()
notifyAll()
setCountryCode(int value)Identifies 3 digit country code.
setECIEncoding(int value)Sets ECI encoding.
setMaxiCodeEncodeMode(MaxiCodeEncodeMode value)Sets a MaxiCode encode mode.
setPostalCode(String value)Identifies the postal code.
setSecondMessage(MaxiCodeSecondMessage value)Identifies second message of the barcode.
setServiceCategory(int value)Identifies 3 digit service category.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

MaxiCodeCodetextMode2()

public MaxiCodeCodetextMode2()

equals(Object obj)

public boolean equals(Object obj)

Returns a value indicating whether this instance is equal to a specified MaxiCodeStructuredCodetext value.

Parameters:

ParameterTypeDescription
objjava.lang.ObjectAn MaxiCodeStructuredCodetext value to compare to this instance

Returns: boolean - true if obj has the same value as this instance; otherwise, false

getBarcodeType()

public BaseEncodeType getBarcodeType()

Gets barcode type.

Returns: BaseEncodeType - Barcode type

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getConstructedCodetext()

public String getConstructedCodetext()

Constructs codetext

Returns: java.lang.String - Constructed codetext

getCountryCode()

public int getCountryCode()

Identifies 3 digit country code.

Returns: int

getECIEncoding()

public int getECIEncoding()

Gets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.

Returns: int

getHashCode()

public int getHashCode()

Returns the hash code for this instance.

Returns: int - A 32-bit signed integer hash code.

getMaxiCodeEncodeMode()

public MaxiCodeEncodeMode getMaxiCodeEncodeMode()

Gets a MaxiCode encode mode.

Returns: MaxiCodeEncodeMode

getMode()

public int getMode()

Gets MaxiCode mode.

Returns: int - MaxiCode mode

getPostalCode()

public String getPostalCode()

Identifies the postal code. Must be 9 digits in mode 2 or 6 alphanumeric symbols in mode 3.

Returns: java.lang.String

getSecondMessage()

public MaxiCodeSecondMessage getSecondMessage()

Identifies second message of the barcode.

Returns: MaxiCodeSecondMessage

getServiceCategory()

public int getServiceCategory()

Identifies 3 digit service category.

Returns: int

hashCode()

public native int hashCode()

Returns: int

initFromString(String constructedCodetext)

public void initFromString(String constructedCodetext)

Initializes instance from constructed codetext.

Parameters:

ParameterTypeDescription
constructedCodetextjava.lang.StringConstructed codetext.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setCountryCode(int value)

public void setCountryCode(int value)

Identifies 3 digit country code.

Parameters:

ParameterTypeDescription
valueint

setECIEncoding(int value)

public void setECIEncoding(int value)

Sets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.

Parameters:

ParameterTypeDescription
valueint

setMaxiCodeEncodeMode(MaxiCodeEncodeMode value)

public void setMaxiCodeEncodeMode(MaxiCodeEncodeMode value)

Sets a MaxiCode encode mode.

Parameters:

ParameterTypeDescription
valueMaxiCodeEncodeMode

setPostalCode(String value)

public final void setPostalCode(String value)

Identifies the postal code. Must be 9 digits in mode 2 or 6 alphanumeric symbols in mode 3.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setSecondMessage(MaxiCodeSecondMessage value)

public void setSecondMessage(MaxiCodeSecondMessage value)

Identifies second message of the barcode.

Parameters:

ParameterTypeDescription
valueMaxiCodeSecondMessage

setServiceCategory(int value)

public void setServiceCategory(int value)

Identifies 3 digit service category.

Parameters:

ParameterTypeDescription
valueint

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int