docs: @Override
      protected void encode() {
          String formatControlCode = "00";
          String deliveryPointId;
          String barStateValues;
          String zeroPaddedInput = "";
          int i;
  
          switch(mode) {
              case AUSPOST:
                  switch(content.length()) {
                      case 8: formatControlCode = "11";
                          break;
                      case 13: formatControlCode = "59";
                          break;
                      case 16: formatControlCode = "59";
                          if (!content.matches("[0-9]+")) {
                              throw new OkapiException("Invalid characters in data");
                          }
                          break;
                      case 18: formatControlCode = "62";
                          break;
                      case 23: formatControlCode = "62";
                          if (!content.matches("[0-9]+")) {
                              throw new OkapiException("Invalid characters in data");
                          }
                          break;
                      default: throw new OkapiException("Auspost input is wrong length");
                  }
                  break;
              case AUSREPLY:
                  if (content.length() > 8) {
                      throw new OkapiException("Auspost input is too long");
                  } else {
                      formatControlCode = "45";
                  }
                  break;
              case AUSROUTE:
                  if (content.length() > 8) {
                      throw new OkapiException("Auspost input is too long");
                  } else {
                      formatControlCode = "87";
                  }
                  break;
              case AUSREDIRECT:
                  if (content.length() > 8) {
                      throw new OkapiException("Auspost input is too long");
                  } else {
                      formatControlCode = "92";
                  }
                  break;
          }
  
          encodeInfo += "FCC: " + formatControlCode + '\n';
  
          if(mode != ausMode.AUSPOST) {
              for (i = content.length(); i < 8; i++) {
                  zeroPaddedInput += "0";
              }
          }
          zeroPaddedInput += content;
  
          if (!content.matches("[0-9A-Za-z #]+")) {
              throw new OkapiException("Invalid characters in data");
          }
  
          /* Verify that the first 8 characters are numbers */
          deliveryPointId = zeroPaddedInput.substring(0, 8);
  
          if (!deliveryPointId.matches("[0-9]+")) {
              throw new OkapiException("Invalid characters in DPID");
          }
  
          encodeInfo += "DPID: " + deliveryPointId + '\n';
  
          /* Start */
          barStateValues = "13";
  
          /* Encode the FCC */
          for(i = 0; i < 2; i++) {
              barStateValues += N_ENCODING_TABLE[formatControlCode.charAt(i) - '0'];
          }
  
          /* Delivery Point Identifier (DPID) */
          for(i = 0; i < 8; i++) {
              barStateValues += N_ENCODING_TABLE[deliveryPointId.charAt(i) - '0'];
          }
  
          /* Customer Information */
          switch(zeroPaddedInput.length()) {
              case 13:
              case 18:
                  for(i = 8; i < zeroPaddedInput.length(); i++) {
                      barStateValues += C_ENCODING_TABLE[positionOf(zeroPaddedInput.charAt(i), CHARACTER_SET)];
                  }
                  break;
              case 16:
              case 23:
                  for(i = 8; i < zeroPaddedInput.length(); i++) {
                      barStateValues += N_ENCODING_TABLE[positionOf(zeroPaddedInput.charAt(i), CHARACTER_SET)];
                  }
                  break;
          }
  
          /* Filler bar */
          switch(barStateValues.length()) {
              case 22:
              case 37:
              case 52:
                  barStateValues += "3";
                  break;
          }
  
          /* Reed Solomon error correction */
          barStateValues += calcReedSolomon(barStateValues);
  
          /* Stop character */
          barStateValues += "13";
  
          encodeInfo += "Total Length: " + barStateValues.length() + '\n';
          encodeInfo += "Encoding: ";
          for (i = 0; i < barStateValues.length(); i++) {
              switch (barStateValues.charAt(i)) {
                  case '1':
                      encodeInfo += "A";
                      break;
                  case '2':
                      encodeInfo += "D";
                      break;
                  case '0':
                      encodeInfo += "F";
                      break;
                  case '3':
                      encodeInfo += "T";
                      break;
              }
          }
          encodeInfo += "\n";
  
          readable = "";
          pattern = new String[1];
          pattern[0] = barStateValues;
          row_count = 1;
          row_height = new int[1];
          row_height[0] = -1;
      }