private void _decode(AsnInputStream ais, int length)
      throws CAPParsingComponentException, IOException, AsnException, MAPParsingComponentException {

    this.maxTransferredVolume = -1;
    this.maxElapsedTime = -1;

    int tag = ais.getTag();

    if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
      switch (tag) {
        case _ID_maxTransferredVolume:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".maxTransferredVolume: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.maxTransferredVolume = (long) ais.readIntegerData(length);
          break;
        case _ID_maxElapsedTime:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".maxElapsedTime: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.maxElapsedTime = (int) ais.readIntegerData(length);
          break;

        default:
          throw new CAPParsingComponentException(
              "Error while decoding " + _PrimitiveName + ": bad choice tag",
              CAPParsingComponentExceptionReason.MistypedParameter);
      }
    } else {
      throw new CAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": bad choice tagClass",
          CAPParsingComponentExceptionReason.MistypedParameter);
    }
  }
Ejemplo n.º 2
0
  private void _decode(AsnInputStream ais, int length)
      throws CAPParsingComponentException, IOException, AsnException, MAPParsingComponentException {

    this.volumeIfNoTariffSwitch = null;
    this.volumeIfTariffSwitch = null;

    int tag = ais.getTag();

    if (ais.getTagClass() == Tag.CLASS_CONTEXT_SPECIFIC) {
      switch (tag) {
        case _ID_volumeIfNoTariffSwitch:
          if (!ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".volumeIfNoTariffSwitch: Parameter is not primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.volumeIfNoTariffSwitch = ais.readIntegerData(length);
          break;
        case _ID_volumeIfTariffSwitch:
          if (ais.isTagPrimitive())
            throw new CAPParsingComponentException(
                "Error while decoding "
                    + _PrimitiveName
                    + ".volumeIfTariffSwitch: Parameter is primitive",
                CAPParsingComponentExceptionReason.MistypedParameter);
          this.volumeIfTariffSwitch = new VolumeIfTariffSwitchImpl();
          ((VolumeIfTariffSwitchImpl) this.volumeIfTariffSwitch).decodeData(ais, length);
          break;

        default:
          throw new CAPParsingComponentException(
              "Error while decoding " + _PrimitiveName + ": bad choice tag",
              CAPParsingComponentExceptionReason.MistypedParameter);
      }
    } else {
      throw new CAPParsingComponentException(
          "Error while decoding " + _PrimitiveName + ": bad choice tagClass",
          CAPParsingComponentExceptionReason.MistypedParameter);
    }
  }