code: public void encode(AsnOutputStream aos) throws EncodeException {
          if (this.operationCode == null)
              throw new EncodeException("Error encoding Invoke: operationCode is mandatory but is not set");
  
          try {
              // tag
              if (this.notLast)
                  aos.writeTag(Tag.CLASS_PRIVATE, false, Invoke._TAG_INVOKE_NOT_LAST);
              else
                  aos.writeTag(Tag.CLASS_PRIVATE, false, Invoke._TAG_INVOKE_LAST);
              int pos = aos.StartContentDefiniteLength();
  
              // invokeId and correlationId
              byte[] buf;
              if (this.invokeId != null) {
                  if (this.correlationId != null) {
                      buf = new byte[2];
                      buf[0] = (byte) (long) this.invokeId;
                      buf[1] = (byte) (long) this.correlationId;
                  } else {
                      buf = new byte[1];
                      buf[0] = (byte) (long) this.invokeId;
                  }
              } else {
                  buf = new byte[0];
              }
              aos.writeOctetString(Tag.CLASS_PRIVATE, Component._TAG_INVOKE_ID, buf);
  
              // operationCode
              this.operationCode.encode(aos);
  
              // parameters
              if (this.parameter != null)
                  this.parameter.encode(aos);
              else
                  ParameterImpl.encodeEmptyParameter(aos);
  
              aos.FinalizeContent(pos);
  
          } catch (IOException e) {
              throw new EncodeException("IOException while encoding Invoke: " + e.getMessage(), e);
          } catch (AsnException e) {
              throw new EncodeException("AsnException while encoding Invoke: " + e.getMessage(), e);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.protocols.ss7.tcap.asn.Encodable#encode(org.mobicents.protocols .asn.AsnOutputStream)