public void decode(AsnInputStream ais) throws ParseException {
        try {
            AsnInputStream localAis = ais.readSequenceStream();

            // int make read whole thing?
            int tag = localAis.readTag();
            if (localAis.getTagClass() != Tag.CLASS_CONTEXT_SPECIFIC)
                throw new ParseException(PAbortCauseType.IncorrectTxPortion, null,
                        "Error while decoding AARE-apdu.result-dource-diagnostic sequence part: bad tag class: tagClass="
                                + localAis.getTagClass());

            switch (tag) {
                case _TAG_U:
                    AsnInputStream localAis2 = localAis.readSequenceStream();
                    tag = localAis2.readTag();
                    if (tag != Tag.INTEGER || localAis2.getTagClass() != Tag.CLASS_UNIVERSAL)
                        throw new ParseException(PAbortCauseType.IncorrectTxPortion, null,
                                "Error while decoding AARE-apdu.result-dource-diagnostic integer part: bad tag or tag class class: tagClass="
                                        + localAis.getTagClass() + ", tag=" + tag);
                    long t = localAis2.readInteger();
                    this.userType = DialogServiceUserType.getFromInt(t);
                    break;

                case _TAG_P:
                    localAis2 = localAis.readSequenceStream();
                    tag = localAis2.readTag();
                    if (tag != Tag.INTEGER || localAis2.getTagClass() != Tag.CLASS_UNIVERSAL)
                        throw new ParseException(PAbortCauseType.IncorrectTxPortion, null,
                                "Error while decoding AARE-apdu.result-dource-diagnostic integer part: bad tag or tag class class: tagClass="
                                        + localAis.getTagClass() + ", tag=" + tag);
                    t = localAis2.readInteger();
                    this.providerType = DialogServiceProviderType.getFromInt(t);
                    break;

                default:
                    throw new ParseException(PAbortCauseType.IncorrectTxPortion, null,
                            "Error while decoding AARE-apdu.result-dource-diagnostic sequence part: bad tag: tag=" + tag);
            }
        } catch (IOException e) {
            throw new ParseException(PAbortCauseType.BadlyFormattedTxPortion, null,
                    "IOException while decoding ResultSourceDiagnostic: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new ParseException(PAbortCauseType.BadlyFormattedTxPortion, null,
                    "AsnException while decoding ResultSourceDiagnostic: " + e.getMessage(), e);
        }

        // tag can have on of two values =
    }
public void decode ( AsnInputStream ais ) throws ParseException { try { AsnInputStream localAis = ais . readSequenceStream ( ) ; int tag = localAis . readTag ( ) ; if ( localAis . getTagClass ( ) != Tag . CLASS_CONTEXT_SPECIFIC ) throw new ParseException ( PAbortCauseType . IncorrectTxPortion , null , "Error while decoding AARE-apdu.result-dource-diagnostic sequence part: bad tag class: tagClass=" + localAis . getTagClass ( ) ) ; switch ( tag ) { case _TAG_U : AsnInputStream localAis2 = localAis . readSequenceStream ( ) ; tag = localAis2 . readTag ( ) ; if ( tag != Tag . INTEGER || localAis2 . getTagClass ( ) != Tag . CLASS_UNIVERSAL ) throw new ParseException ( PAbortCauseType . IncorrectTxPortion , null , "Error while decoding AARE-apdu.result-dource-diagnostic integer part: bad tag or tag class class: tagClass=" + localAis . getTagClass ( ) + ", tag=" + tag ) ; long t = localAis2 . readInteger ( ) ; this . userType = DialogServiceUserType . getFromInt ( t ) ; break ; case _TAG_P : localAis2 = localAis . readSequenceStream ( ) ; tag = localAis2 . readTag ( ) ; if ( tag != Tag . INTEGER || localAis2 . getTagClass ( ) != Tag . CLASS_UNIVERSAL ) throw new ParseException ( PAbortCauseType . IncorrectTxPortion , null , "Error while decoding AARE-apdu.result-dource-diagnostic integer part: bad tag or tag class class: tagClass=" + localAis . getTagClass ( ) + ", tag=" + tag ) ; t = localAis2 . readInteger ( ) ; this . providerType = DialogServiceProviderType . getFromInt ( t ) ; break ; default : throw new ParseException ( PAbortCauseType . IncorrectTxPortion , null , "Error while decoding AARE-apdu.result-dource-diagnostic sequence part: bad tag: tag=" + tag ) ; } } catch ( IOException e ) { throw new ParseException ( PAbortCauseType . BadlyFormattedTxPortion , null , "IOException while decoding ResultSourceDiagnostic: " + e . getMessage ( ) , e ) ; } catch ( AsnException e ) { throw new ParseException ( PAbortCauseType . BadlyFormattedTxPortion , null , "AsnException while decoding ResultSourceDiagnostic: " + e . getMessage ( ) , e ) ; } }
/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.tcap.asn.Encodable#decode(org.mobicents.protocols .asn.AsnInputStream)