code: public void encode(AsnOutputStream aos) throws EncodeException {
  
          if (this.nationalErrorCode == null && this.privateErrorCode == null)
              throw new EncodeException("Error code: No error code set!");
  
          try {
              if (this.type == ErrorCodeType.National && this.nationalErrorCode != null) {
                  aos.writeInteger(Tag.CLASS_PRIVATE, ErrorCode._TAG_NATIONAL, this.nationalErrorCode);
              } else if (this.type == ErrorCodeType.Private && this.privateErrorCode != null) {
                  aos.writeInteger(Tag.CLASS_PRIVATE, ErrorCode._TAG_PRIVATE, this.privateErrorCode);
              } else {
                  throw new EncodeException("Error code: No error code set!");
              }
  
          } catch (IOException e) {
              throw new EncodeException("IOException while encoding ErrorCode: " + e.getMessage(), e);
          } catch (AsnException e) {
              throw new EncodeException("AsnException while encoding ErrorCode: " + e.getMessage(), e);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.protocols.ss7.tcap.asn.Encodable#encode(org.mobicents.protocols .asn.AsnOutputStream)