code: public void encode(AsnOutputStream aos) throws EncodeException {
  
          if (acn == null)
              throw new EncodeException("Error encoding DialogResponseAPDU: Application Context Name must not be null");
          if (result == null)
              throw new EncodeException("Error encoding DialogResponseAPDU: Result must not be null");
          if (diagnostic == null)
              throw new EncodeException("Error encoding DialogResponseAPDU: Result-source-diagnostic must not be null");
  
          try {
  
              aos.writeTag(Tag.CLASS_APPLICATION, false, _TAG_RESPONSE);
              int pos = aos.StartContentDefiniteLength();
  
              if (!doNotSendProtocolVersion)
                  this.protocolVersion.encode(aos);
              this.acn.encode(aos);
              this.result.encode(aos);
              this.diagnostic.encode(aos);
  
              if (ui != null)
                  ui.encode(aos);
  
              aos.FinalizeContent(pos);
  
          } catch (AsnException e) {
              throw new EncodeException("AsnException while encoding DialogResponseAPDU: " + e.getMessage(), e);
          }
  
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.protocols.ss7.tcap.asn.Encodable#encode(org.mobicents.protocols .asn.AsnOutputStream)