Example #1
0
  protected void _decode(AsnInputStream ansIS, int length)
      throws CAPParsingComponentException, IOException {

    if (!ansIS.isTagPrimitive())
      throw new CAPParsingComponentException(
          "Error decoding " + _PrimitiveName + ": field must be primitive",
          CAPParsingComponentExceptionReason.MistypedParameter);

    if (length < this.minLength || length > this.maxLength)
      throw new CAPParsingComponentException(
          "Error decoding "
              + _PrimitiveName
              + ": the field must contain from "
              + this.minLength
              + " to "
              + this.maxLength
              + " octets. Contains: "
              + length,
          CAPParsingComponentExceptionReason.MistypedParameter);

    data = new byte[length];
    ansIS.read(data);
  }