Skip to content

Latest commit

 

History

History
411 lines (307 loc) · 12.1 KB

File metadata and controls

411 lines (307 loc) · 12.1 KB
title MaxiCodeCodetextMode2
second_title Aspose.BarCode for Android via Java API Reference
description Class for encoding and decoding the text embedded in the MaxiCode code for modes 2.
type docs
weight 26
url /androidjava/com.aspose.barcode.complexbarcode/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("c:\\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("c:\\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

Constructor Description
MaxiCodeCodetextMode2()

Methods

Method Description
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() {#MaxiCodeCodetextMode2--}

public MaxiCodeCodetextMode2()

equals(Object obj) {#equals-java.lang.Object-}

public boolean equals(Object obj)

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

Parameters:

Parameter Type Description
obj java.lang.Object An MaxiCodeStructuredCodetext value to compare to this instance

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

getBarcodeType() {#getBarcodeType--}

public BaseEncodeType getBarcodeType()

Gets barcode type.

Returns: BaseEncodeType - Barcode type

getClass() {#getClass--}

public final native Class<?> getClass()

Returns: java.lang.Class<?>

getConstructedCodetext() {#getConstructedCodetext--}

public String getConstructedCodetext()

Constructs codetext

Returns: java.lang.String - Constructed codetext

getCountryCode() {#getCountryCode--}

public int getCountryCode()

Identifies 3 digit country code.

Returns: int

getECIEncoding() {#getECIEncoding--}

public int getECIEncoding()

Gets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.

Returns: int

getHashCode() {#getHashCode--}

public int getHashCode()

Returns the hash code for this instance.

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

getMaxiCodeEncodeMode() {#getMaxiCodeEncodeMode--}

public MaxiCodeEncodeMode getMaxiCodeEncodeMode()

Gets a MaxiCode encode mode.

Returns: MaxiCodeEncodeMode

getMode() {#getMode--}

public int getMode()

Gets MaxiCode mode.

Returns: int - MaxiCode mode

getPostalCode() {#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() {#getSecondMessage--}

public MaxiCodeSecondMessage getSecondMessage()

Identifies second message of the barcode.

Returns: MaxiCodeSecondMessage

getServiceCategory() {#getServiceCategory--}

public int getServiceCategory()

Identifies 3 digit service category.

Returns: int

hashCode() {#hashCode--}

public native int hashCode()

Returns: int

initFromString(String constructedCodetext) {#initFromString-java.lang.String-}

public void initFromString(String constructedCodetext)

Initializes instance from constructed codetext.

Parameters:

Parameter Type Description
constructedCodetext java.lang.String Constructed codetext.

notify() {#notify--}

public final native void notify()

notifyAll() {#notifyAll--}

public final native void notifyAll()

setCountryCode(int value) {#setCountryCode-int-}

public void setCountryCode(int value)

Identifies 3 digit country code.

Parameters:

Parameter Type Description
value int

setECIEncoding(int value) {#setECIEncoding-int-}

public void setECIEncoding(int value)

Sets ECI encoding. Used when MaxiCodeEncodeMode is AUTO.

Parameters:

Parameter Type Description
value int

setMaxiCodeEncodeMode(MaxiCodeEncodeMode value) {#setMaxiCodeEncodeMode-com.aspose.barcode.generation.MaxiCodeEncodeMode-}

public void setMaxiCodeEncodeMode(MaxiCodeEncodeMode value)

Sets a MaxiCode encode mode.

Parameters:

Parameter Type Description
value MaxiCodeEncodeMode

setPostalCode(String value) {#setPostalCode-java.lang.String-}

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:

Parameter Type Description
value java.lang.String

setSecondMessage(MaxiCodeSecondMessage value) {#setSecondMessage-com.aspose.barcode.complexbarcode.MaxiCodeSecondMessage-}

public void setSecondMessage(MaxiCodeSecondMessage value)

Identifies second message of the barcode.

Parameters:

Parameter Type Description
value MaxiCodeSecondMessage

setServiceCategory(int value) {#setServiceCategory-int-}

public void setServiceCategory(int value)

Identifies 3 digit service category.

Parameters:

Parameter Type Description
value int

toString() {#toString--}

public String toString()

Returns: java.lang.String

wait() {#wait--}

public final void wait()

wait(long arg0) {#wait-long-}

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1) {#wait-long-int-}

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int