public void encode(AsnOutputStream aos) throws EncodeException {

    if (this.component == null || this.component.length == 0)
      throw new EncodeException(
          "Error encoding TC-Uni: Component portion is mandatory but not defined");

    try {

      aos.writeTag(Tag.CLASS_APPLICATION, false, _TAG);
      int pos = aos.StartContentDefiniteLength();

      if (this.dp != null) this.dp.encode(aos);

      aos.writeTag(Tag.CLASS_APPLICATION, false, Component._COMPONENT_TAG);
      int pos2 = aos.StartContentDefiniteLength();
      for (Component c : this.component) {
        c.encode(aos);
      }
      aos.FinalizeContent(pos2);

      aos.FinalizeContent(pos);

    } catch (AsnException e) {
      throw new EncodeException("AsnException while encoding TC-Uni: " + e.getMessage(), e);
    }
  }
Beispiel #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.mobicents.protocols.protocols.ss7.cap.api.map.api.primitives.MAPAsnPrimitive#encodeAll
  * (com.ebridge.protocols.asn.AsnOutputStream, int, int)
  */
 public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {
   try {
     asnOs.writeTag(tagClass, this.getIsPrimitive(), tag);
     int pos = asnOs.StartContentDefiniteLength();
     this.encodeData(asnOs);
     asnOs.FinalizeContent(pos);
   } catch (AsnException e) {
     throw new MAPException(
         "AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
   }
 }
  public void encodeAll(AsnOutputStream asnOs, int tagClass, int tag) throws MAPException {

    try {
      asnOs.writeTag(tagClass, false, tag);
      int pos = asnOs.StartContentDefiniteLength();
      this.encodeData(asnOs);
      asnOs.FinalizeContent(pos);
    } catch (AsnException e) {
      throw new MAPException(
          "AsnException when encoding MAPErrorMessageFacilityNotSup: " + e.getMessage(), e);
    }
  }