/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.map.primitives.MAPAsnPrimitive#encodeData (org.mobicents.protocols.asn.AsnOutputStream)
328653
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        if (this.pdpType == null || this.qosSubscribed == null || this.apn == null) {
            throw new MAPException("pdpType, qosSubscribed and apn parameters must not be null");
        }

        try {
            asnOs.writeInteger((int) this.pdpContextId);

            ((PDPTypeImpl) this.pdpType).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_pdp_Type);

            if (this.pdpAddress != null)
                ((PDPAddressImpl) this.pdpAddress).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_pdp_Address);

            ((QoSSubscribedImpl) this.qosSubscribed).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_QoS_Subscribed);

            if (this.vplmnAddressAllowed)
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _ID_vplmnAddressAllowed);

            ((APNImpl) this.apn).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_apn);

            if (this.extensionContainer != null)
                ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_extensionContainer);

            if (this.extQoSSubscribed != null)
                ((ExtQoSSubscribedImpl) this.extQoSSubscribed).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_ext_QoS_Subscribed);

            if (this.chargingCharacteristics != null)
                ((ChargingCharacteristicsImpl) this.chargingCharacteristics).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_pdp_ChargingCharacteristics);

            if (this.ext2QoSSubscribed != null)
                ((Ext2QoSSubscribedImpl) this.ext2QoSSubscribed).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_ext2_QoS_Subscribed);

            if (this.ext3QoSSubscribed != null)
                ((Ext3QoSSubscribedImpl) this.ext3QoSSubscribed).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_ext3_QoS_Subscribed);

            if (this.ext4QoSSubscribed != null)
                ((Ext4QoSSubscribedImpl) this.ext4QoSSubscribed).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_ext4_QoS_Subscribed);

            if (this.apnoiReplacement != null)
                ((APNOIReplacementImpl) this.apnoiReplacement).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                        _ID_apn_oi_Replacement);

            if (this.extpdpType != null)
                ((ExtPDPTypeImpl) this.extpdpType).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_ext_pdp_Type);

            if (this.extpdpAddress != null)
                ((PDPAddressImpl) this.extpdpAddress).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _ID_ext_pdp_Address);

            if (this.sipToPermission != null)
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _ID_sipto_Permission, this.sipToPermission.getCode());

            if (this.lipaPermission != null)
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _ID_lipa_Permission, this.lipaPermission.getCode());

        } catch (IOException e) {
            throw new MAPException("IOException when encoding PDPContext : " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding PDPContext : " + e.getMessage(), e);
        }
    }
569272
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.lcsClientType == null)
            throw new MAPException("lcsClientType must not be null");

        try {
            asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_CLIENT_TYPE, this.lcsClientType.getType());
        } catch (IOException e) {
            throw new MAPException("IOException when encoding parameter lcsClientType: ", e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding parameter lcsClientType: ", e);
        }

        if (this.lcsClientExternalID != null) {
            // Encode lcsClientExternalID [1] LCSClientExternalID OPTIONAL,
            ((LCSClientExternalIDImpl) this.lcsClientExternalID).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_LCS_CLIENT_EXTERNAL_ID);
        }

        if (this.lcsClientDialedByMS != null) {
            // lcsClientDialedByMS [2] AddressString OPTIONAL,
            ((AddressStringImpl) this.lcsClientDialedByMS).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_LCS_CLIENT_DIALED_BY_MS);
        }

        if (this.lcsClientInternalID != null) {
            // lcsClientInternalID [3] LCSClientInternalID OPTIONAL,
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_CLIENT_INTERNAL_ID, this.lcsClientInternalID.getId());
            } catch (IOException e) {
                throw new MAPException("IOException when encoding parameter lcsClientInternalID: ", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException when encoding parameter lcsClientInternalID: ", e);
            }
        }

        if (this.lcsClientName != null) {
            // lcsClientName [4] LCSClientName
            ((LCSClientNameImpl) this.lcsClientName).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_CLIENT_NAME);
        }

        if (this.lcsAPN != null) {
            // lcsAPN [5] APN OPTIONAL,
            ((APNImpl) this.lcsAPN).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_APN);
        }

        if (this.lcsRequestorID != null) {
            // lcsRequestorID [6] LCSRequestorID
            ((LCSRequestorIDImpl) this.lcsRequestorID).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_REQUESTOR_ID);
        }
    }
722468
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.locationEstimate == null) {
            throw new MAPException("Error while encoding " + _PrimitiveName
                    + " the mandatory parameter locationEstimate is not defined");
        }

        ((ExtGeographicalInformationImpl) this.locationEstimate).encodeAll(asnOs);

        if (this.ageOfLocationEstimate != null) {
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_AGE_OF_LOCATION_ESTIMATE, this.ageOfLocationEstimate);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding parameter " + _PrimitiveName + " .ageOfLocationEstimate", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName + " .ageOfLocationEstimate", e);
            }
        }

        if (this.extensionContainer != null) {
            ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_EXTENSIONCONTAINER);
        }

        if (this.additionalLocationEstimate != null) {
            ((AddGeographicalInformationImpl) this.additionalLocationEstimate).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_ADD_LOCATION_ESTIMATE);
        }

        if (this.deferredMTLRResponseIndicator) {
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_DEFERRED_MT_LR_RESPONSE_IND);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding parameter " + _PrimitiveName
                        + " .deferredMTLRResponseIndicator", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName
                        + " .deferredMTLRResponseIndicator", e);
            }
        }

        if (this.geranPositioningData != null) {
            ((PositioningDataInformationImpl) this.geranPositioningData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_GERAN_POSITIONING_DATA);
        }

        if (this.utranPositioningData != null) {
            ((UtranPositioningDataInfoImpl) this.utranPositioningData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_UTRAN_POSITIONING_DATA);
        }

        if (this.cellGlobalIdOrServiceAreaIdOrLAI != null) {
            try {
                asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_CELL_ID_OR_SAI);
                int pos = asnOs.StartContentDefiniteLength();
                ((CellGlobalIdOrServiceAreaIdOrLAIImpl) this.cellGlobalIdOrServiceAreaIdOrLAI).encodeAll(asnOs);
                asnOs.FinalizeContent(pos);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName
                        + " .cellGlobalIdOrServiceAreaIdOrLAI", e);
            }
        }

        if (this.saiPresent) {
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_SAI_PRESENT);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding parameter " + _PrimitiveName + " .saiPresent", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName + " saiPresent", e);
            }
        }

        if (this.accuracyFulfilmentIndicator != null) {
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_ACCURACY_FULFILMENT_INDICATOR,
                        this.accuracyFulfilmentIndicator.getIndicator());
            } catch (IOException e) {
                throw new MAPException("IOException while encoding parameter " + _PrimitiveName
                        + " .accuracyFulfilmentIndicator", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName
                        + " .accuracyFulfilmentIndicator", e);
            }
        }

        if (this.velocityEstimate != null) {
            ((VelocityEstimateImpl) this.velocityEstimate).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_velocityEstimate);
        }

        if (this.moLrShortCircuitIndicator) {
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_mo_lrShortCircuitIndicator);
            } catch (IOException e) {
                throw new MAPException(
                        "IOException while encoding parameter " + _PrimitiveName + " .moLrShortCircuitIndicator", e);
            } catch (AsnException e) {
                throw new MAPException(
                        "AsnException while encoding parameter " + _PrimitiveName + " moLrShortCircuitIndicator", e);
            }
        }

        if (this.geranGANSSpositioningData != null) {
            ((GeranGANSSpositioningDataImpl) this.geranGANSSpositioningData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_geranGANSSpositioningData);
        }

        if (this.utranGANSSpositioningData != null) {
            ((UtranGANSSpositioningDataImpl) this.utranGANSSpositioningData).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_utranGANSSpositioningData);
        }

        if (this.targetServingNodeForHandover != null) {
            try {
                asnOs.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG_targetServingNodeForHandover);
                int pos = asnOs.StartContentDefiniteLength();
                ((ServingNodeAddressImpl) this.targetServingNodeForHandover).encodeAll(asnOs);
                asnOs.FinalizeContent(pos);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding parameter " + _PrimitiveName
                        + " .targetServingNodeForHandover", e);
            }
        }
    }
794518
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.horizontalAccuracy != null) {
            try {
                asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_HORIZONTAL_ACCURACY,
                        new byte[] { this.horizontalAccuracy.byteValue() });
            } catch (IOException e) {
                throw new MAPException("IOException when encoding parameter horizontalAccuracy: ", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException when encoding parameter horizontalAccuracy: ", e);
            }
        }

        if (this.verticalCoordinateRequest) {
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_VERTICAL_COORDINATE_REQUEST);
            } catch (IOException e) {
                throw new MAPException("IOException when encoding parameter verticalCoordinateRequest: ", e);
            } catch (AsnException e) {
                throw new MAPException("IOException when encoding parameter verticalCoordinateRequest: ", e);
            }
        }

        if (this.verticalAccuracy != null) {
            try {
                asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_VERTICAL_ACCURACY,
                        new byte[] { this.verticalAccuracy.byteValue() });
            } catch (IOException e) {
                throw new MAPException("IOException when encoding parameter verticalAccuracy: ", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException when encoding parameter verticalAccuracy: ", e);
            }
        }

        if (this.responseTime != null) {
            ((ResponseTimeImpl) this.responseTime).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_RESPONSE_TIME);
        }

        if (this.extensionContainer != null) {
            ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_EXTENSION_CONTAINER);
        }
    }
1337638
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.areaDefinition == null) {
            throw new MAPException("Error while encoding " + _PrimitiveName
                    + " the mandatory parameter[areaDefinition [0] AreaDefinition] is not defined");
        }

        ((AreaDefinitionImpl) this.areaDefinition).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_areaDefinition);

        try {
            if (this.occurrenceInfo != null) {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_OCCURRENCE_INFO, this.occurrenceInfo.getInfo());
            }

            if (this.intervalTime != null) {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_INTERVAL_TIME, this.intervalTime);
            }

        } catch (IOException e) {
            throw new MAPException("IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
        }
    }
618816
public byte[] encode(Map<String, String> map) throws SerializationException {
        if (map == null || map.isEmpty()) {
            return null;
        }
        UnsafeByteArrayOutputStream out = new UnsafeByteArrayOutputStream(64);
        try {
            for (Map.Entry<String, String> entry : map.entrySet()) {
                writeString(out, entry.getKey());
                writeString(out, entry.getValue());
            }
            return out.toByteArray();
        } catch (IOException ex) {
            throw new SerializationException(ex.getMessage(), ex);
        }
    }
494778
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        int cnt = 0;
        if (this.forwardingInfo != null)
            cnt++;
        if (this.callBarringInfo != null)
            cnt++;
        if (this.cugInfo != null)
            cnt++;
        if (this.ssData != null)
            cnt++;
        if (this.emlppInfo != null)
            cnt++;

        if (cnt != 1)
            throw new MAPException("Error while encoding " + _PrimitiveName + ": one and only one choice is required.");

        if (this.forwardingInfo != null) {
            ((ExtForwInfoImpl) this.forwardingInfo).encodeData(asnOs);
            return;
        }

        if (this.callBarringInfo != null) {
            ((ExtCallBarInfoImpl) this.callBarringInfo).encodeData(asnOs);
            return;
        }

        if (this.cugInfo != null) {
            ((CUGInfoImpl) this.cugInfo).encodeData(asnOs);
            return;
        }

        if (this.ssData != null) {
            ((ExtSSDataImpl) this.ssData).encodeData(asnOs);
            return;
        }

        if (this.emlppInfo != null) {
            ((EMLPPInfoImpl) this.emlppInfo).encodeData(asnOs);
            return;
        }
    }
189889
public void encodeData(AsnOutputStream asnOs) throws MAPException {

        if (this.interCugRestrictions == null)
            throw new MAPException("Error while encoding " + _PrimitiveName + ": interCugRestrictions required.");

        try {

            if (this.basicService != null)
                ((ExtBasicServiceCodeImpl) this.basicService).encodeAll(asnOs);

            if (this.preferentialCugIndicator != null)
                asnOs.writeInteger(this.preferentialCugIndicator);

            ((InterCUGRestrictionsImpl) this.interCugRestrictions).encodeAll(asnOs);

            if (this.extensionContainer != null)
                ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(asnOs);
        } catch (IOException e) {
            throw new MAPException("IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
        }
    }
882216
public void encode(AsnOutputStream aos) throws EncodeException {

        try {
            if (this.isInteger()) {
                aos.writeInteger(Tag.CLASS_PRIVATE, ApplicationContext._TAG_INTEGER, integerVal);
            } else if (this.isObjectID()) {
                aos.writeObjectIdentifier(Tag.CLASS_PRIVATE, ApplicationContext._TAG_OBJECT_ID, this.oidVal);
            } else {
                throw new EncodeException("Error while encoding ApplicationContextName: Neither OId nor Integer value is set");
            }

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding ApplicationContextName: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding ApplicationContextName: " + e.getMessage(), e);
        }
    }
787854
func encodeData(o interface{}) (io.Reader, int, error) {
	if o == nil {
		return nil, 0, nil
	}
	buf, err := json.Marshal(&o)
	if err != nil {
		return nil, 0, err
	} else {
		return bytes.NewReader(buf), len(buf), nil
	}
}
673474
@Benchmark
  @BenchmarkMode(Mode.AverageTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public byte[] encodeSpanBinary(Data data) {
    return data.propagation.getBinaryFormat().toByteArray(data.spanToEncode.getContext());
  }
369189
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.locationType == null) {
            throw new MAPException("Error while encoding " + _PrimitiveName
                    + " the mandatory parameter locationType is not defined");
        }

        if (this.mlcNumber == null) {
            throw new MAPException("Error while encoding " + _PrimitiveName
                    + " the mandatory parameter mlc-Number is not defined");
        }

        ((LocationTypeImpl) this.locationType).encodeAll(asnOs);

        ((ISDNAddressStringImpl) this.mlcNumber).encodeAll(asnOs);

        if (this.lcsClientID != null) {
            // lcs-ClientID [0] LCS-ClientID OPTIONAL
            ((LCSClientIDImpl) this.lcsClientID).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_CLIENT_ID);
        }

        if (this.privacyOverride) {
            // privacyOverride [1] NULL OPTIONAL
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_PRIVACY_OVERRIDE);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding " + _PrimitiveName + " parameter privacyOverride", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding " + _PrimitiveName + " parameter privacyOverride", e);
            }
        }

        if (this.imsi != null) {
            // imsi [2] IMSI OPTIONAL
            ((IMSIImpl) this.imsi).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMSI);
        }

        if (this.msisdn != null) {
            // msisdn [3] ISDN-AddressString OPTIONAL,
            ((ISDNAddressStringImpl) this.msisdn).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_MSISDN);
        }

        if (this.lmsi != null) {
            // lmsi [4] LMSI OPTIONAL,
            ((LMSIImpl) this.lmsi).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LMSI);
        }

        if (this.imei != null) {
            // imei [5] IMEI OPTIONAL,
            ((IMEIImpl) this.imei).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_IMEI);
        }

        if (this.lcsPriority != null) {
            // lcs-Priority [6] LCS-Priority OPTIONAL,
            try {
                asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_PRIORITY,
                        new byte[] { (byte) this.lcsPriority.getCode() });
            } catch (IOException e) {
                throw new MAPException("IOException while encoding " + _PrimitiveName + " parameter lcsPriority", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding " + _PrimitiveName + " parameter lcsPriority", e);
            }
        }

        if (this.lcsQoS != null) {
            // lcs-QoS [7] LCS-QoS OPTIONAL
            ((LCSQoSImpl) this.lcsQoS).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_QOS);
        }

        if (this.extensionContainer != null) {
            // extensionContainer [8] ExtensionContainer OPTIONAL,
            ((MAPExtensionContainerImpl) this.extensionContainer).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_EXTENSION_CONTAINER);
        }

        if (this.supportedGADShapes != null) {
            // supportedGADShapes [9] SupportedGADShapes OPTIONAL
            ((SupportedGADShapesImpl) this.supportedGADShapes).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_SUPPORTED_GAD_SHAPES);
        }

        if (this.lcsReferenceNumber != null) {
            // lcs-ReferenceNumber [10] LCS-ReferenceNumber OPTIONAL,
            try {
                asnOs.writeOctetString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_REFERENCE_NUMBER,
                        new byte[] { this.lcsReferenceNumber.byteValue() });
            } catch (IOException e) {
                throw new MAPException("IOException while encoding " + _PrimitiveName + " parameter lcsReferenceNumber", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding " + _PrimitiveName + " parameter lcsReferenceNumber", e);
            }
        }

        if (this.lcsServiceTypeID != null) {
            // lcsServiceTypeID [11] LCSServiceTypeID OPTIONAL,
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_SERVICE_TYPE_ID, this.lcsServiceTypeID);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding " + _PrimitiveName + " parameter lcsReferenceNumber", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException while encoding " + _PrimitiveName + " parameter lcsReferenceNumber", e);
            }
        }

        if (this.lcsCodeword != null) {
            // lcsCodeword [12] LCSCodeword OPTIONAL,
            ((LCSCodewordImpl) this.lcsCodeword).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_CODEWORD);
        }

        if (this.lcsPrivacyCheck != null) {
            // lcs-PrivacyCheck [13] LCS-PrivacyCheck OPTIONAL,
            ((LCSPrivacyCheckImpl) this.lcsPrivacyCheck).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_PRIVACY_CHECK);
        }

        if (this.areaEventInfo != null) {
            // areaEventInfo [14] AreaEventInfo OPTIONAL,
            ((AreaEventInfoImpl) this.areaEventInfo).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_AREA_EVENT_INFO);
        }

        if (this.hgmlcAddress != null) {
            ((GSNAddressImpl) this.hgmlcAddress).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_H_GMLC_ADDRESS);
        }

        if (this.moLrShortCircuitIndicator) {
            // moLrShortCircuitIndicator
            try {
                asnOs.writeNull(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_mo_lrShortCircuitIndicator);
            } catch (IOException e) {
                throw new MAPException("IOException while encoding " + _PrimitiveName + " parameter moLrShortCircuitIndicator",
                        e);
            } catch (AsnException e) {
                throw new MAPException(
                        "AsnException while encoding " + _PrimitiveName + " parameter moLrShortCircuitIndicator", e);
            }
        }

        if (this.periodicLDRInfo != null) {
            ((PeriodicLDRInfoImpl) this.periodicLDRInfo).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_periodicLDRInfo);
        }

        if (this.reportingPLMNList != null) {
            ((ReportingPLMNListImpl) this.reportingPLMNList).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC,
                    _TAG_reportingPLMNList);
        }
    }
946016
@Nullable protected byte[] decode(@Nullable String data) {
    return data == null ? null : Base64.getUrlDecoder().decode(data);
  }
341409
@Override
    public byte[] encodeAsBytes(long time, int sequence) {
        byte[] buffer = new byte[16];
        buffer[0] = (byte) (time >>> 56);
        buffer[1] = (byte) (time >>> 48);
        buffer[2] = (byte) (time >>> 40);
        buffer[3] = (byte) (time >>> 32);
        buffer[4] = (byte) (time >>> 24);
        buffer[5] = (byte) (time >>> 16);
        buffer[6] = (byte) (time >>> 8);
        buffer[7] = (byte) (time);

        long rest = shiftedMachineId | (0x0000FFFF & sequence);
        buffer[8] = (byte) (rest >>> 56);
        buffer[9] = (byte) (rest >>> 48);
        buffer[10] = (byte) (rest >>> 40);
        buffer[11] = (byte) (rest >>> 32);
        buffer[12] = (byte) (rest >>> 24);
        buffer[13] = (byte) (rest >>> 16);
        buffer[14] = (byte) (rest >>> 8);
        buffer[15] = (byte) (rest);

        return buffer;
    }
982383
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.deferredLocationEventType == null) {
            throw new MAPException("Encdoing of " + _PrimitiveName
                    + " failed. Missing mandatory parameter deferredLocationEventType DeferredLocationEventType");
        }

        ((DeferredLocationEventTypeImpl) this.deferredLocationEventType).encodeAll(asnOs);

        if (this.terminationCause != null) {
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_TERMINATION_CAUSE, this.terminationCause.getCause());
            } catch (IOException e) {
                throw new MAPException("IOException when encoding " + _PrimitiveName + ".terminationCause: " + e.getMessage(),
                        e);
            } catch (AsnException e) {
                throw new MAPException("AsnException when encoding " + _PrimitiveName + ".terminationCause: " + e.getMessage(),
                        e);
            }
        }

        if (this.lcsLocationInfo != null) {
            ((LCSLocationInfoImpl) this.lcsLocationInfo).encodeAll(asnOs, Tag.CLASS_CONTEXT_SPECIFIC, _TAG_LCS_LOCATION_INFO);
        }
    }
92423
public static String encode(byte[] pData) {
        int offset = 0;
        int len;
        StringBuilder buf = new StringBuilder();

        while ((pData.length - offset) > 0) {
            byte a, b, c;
            if ((pData.length - offset) > 2) {
                len = 3;
            }
            else {
                len = pData.length - offset;
            }

            switch (len) {
                case 1:
                    a = pData[offset];
                    b = 0;
                    buf.append(PEM_ARRAY[(a >>> 2) & 0x3F]);
                    buf.append(PEM_ARRAY[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]);
                    buf.append('=');
                    buf.append('=');
                    offset++;
                    break;
                case 2:
                    a = pData[offset];
                    b = pData[offset + 1];
                    c = 0;
                    buf.append(PEM_ARRAY[(a >>> 2) & 0x3F]);
                    buf.append(PEM_ARRAY[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]);
                    buf.append(PEM_ARRAY[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]);
                    buf.append('=');
                    offset += offset + 2; // ???
                    break;
                default:
                    a = pData[offset];
                    b = pData[offset + 1];
                    c = pData[offset + 2];
                    buf.append(PEM_ARRAY[(a >>> 2) & 0x3F]);
                    buf.append(PEM_ARRAY[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]);
                    buf.append(PEM_ARRAY[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]);
                    buf.append(PEM_ARRAY[c & 0x3F]);
                    offset = offset + 3;
                    break;
            }

        }
        return buf.toString();
    }
587962
public void encodeData(AsnOutputStream asnOs) throws MAPException {
        if (this.callSessionUnrelated == null) {
            throw new MAPException(
                    "Error while encoding LCSPrivacyCheck the mandatory parameter callSessionUnrelated is not defined");
        }

        try {
            asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_CALL_SESSION_UNRELATED, this.callSessionUnrelated.getAction());
        } catch (IOException e) {
            throw new MAPException("IOException when encoding parameter LCSPrivacyCheck.callSessionUnrelated", e);
        } catch (AsnException e) {
            throw new MAPException("AsnException when encoding parameter LCSPrivacyCheck.callSessionUnrelated", e);
        }

        if (this.callSessionRelated != null) {
            try {
                asnOs.writeInteger(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_CALL_SESSION_RELATED, this.callSessionRelated.getAction());
            } catch (IOException e) {
                throw new MAPException("IOException when encoding parameter LCSPrivacyCheck.callSessionRelated", e);
            } catch (AsnException e) {
                throw new MAPException("AsnException when encoding parameter LCSPrivacyCheck.callSessionRelated", e);
            }
        }
    }