code: public void encode(AsnOutputStream aos) throws EncodeException {
  
          if (this.correlationId == null)
              throw new EncodeException("Error encoding ReturnResult: correlationId is mandatory but is not set");
  
          try {
              // tag
              if (this.getType() == ComponentType.ReturnResultNotLast)
                  aos.writeTag(Tag.CLASS_PRIVATE, false, ReturnResultNotLast._TAG_RETURN_RESULT_NOT_LAST);
              else
                  aos.writeTag(Tag.CLASS_PRIVATE, false, ReturnResultLast._TAG_RETURN_RESULT_LAST);
              int pos = aos.StartContentDefiniteLength();
  
              // correlationId
              byte[] buf = new byte[1];
              buf[0] = (byte) (long) this.correlationId;
              aos.writeOctetString(Tag.CLASS_PRIVATE, Component._TAG_INVOKE_ID, buf);
  
              // 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 ReturnResult: " + e.getMessage(), e);
          } catch (AsnException e) {
              throw new EncodeException("AsnException while encoding ReturnResult: " + e.getMessage(), e);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.protocols.ss7.tcap.asn.Encodable#encode(org.mobicents.protocols .asn.AsnOutputStream)