예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.mobicents.protocols.ss7.tcap.asn.Encodable#decode(org.mobicents.protocols .asn.AsnInputStream)
   */
  public void decode(AsnInputStream ais) throws ParseException {

    try {

      byte[] buf = ais.readOctetString();
      if (buf == null || buf.length != 1)
        throw new ParseException(
            PAbortCause.BadlyStructuredDialoguePortion,
            "Error decoding ProtocolVersion: bad octet string length");

      this.data = (buf[0] & 0xFF);
    } catch (IOException e) {
      throw new ParseException(
          PAbortCause.BadlyStructuredDialoguePortion,
          "IOException while decoding ProtocolVersion: " + e.getMessage(),
          e);
    } catch (AsnException e) {
      throw new ParseException(
          PAbortCause.BadlyStructuredDialoguePortion,
          "AsnException while decoding ProtocolVersion: " + e.getMessage(),
          e);
    }
  }