@Override public String bytesToUtf8String(byte[] rawData) throws AvpDataException { try { return new String(rawData, "utf8"); } catch (UnsupportedEncodingException e) { throw new AvpDataException("Invalid data type", e); } }
@Override public String bytesToOctetString(byte[] rawData) throws AvpDataException { try { return new String(rawData, "iso-8859-1"); } catch (UnsupportedEncodingException e) { throw new AvpDataException("Invalid data type", e); } }
@Override public int getInteger32() throws AvpDataException { try { return parser.bytesToInt(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public Date bytesToDate(byte[] rawData) throws AvpDataException { try { byte[] tmp = new byte[8]; System.arraycopy(rawData, 0 , tmp, 4, 4); return new Date(((bytesToLong(tmp) - SECOND_SHIFT) * 1000L)); } catch (Exception e) { throw new AvpDataException(e); } }
@Override public String getUTF8String() throws AvpDataException { try { return parser.bytesToUtf8String(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public long getUnsigned32() throws AvpDataException { try { byte[] u32ext = new byte[8]; System.arraycopy(rawData, 0, u32ext, 4, 4); return parser.bytesToLong(u32ext); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public long getUnsigned64() throws AvpDataException { try { return parser.bytesToLong(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public Date getTime() throws AvpDataException { try { return parser.bytesToDate(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public String getDiameterIdentity() throws AvpDataException { try { return parser.bytesToOctetString(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public URI getDiameterURI() throws AvpDataException { try { return new URI(parser.bytesToOctetString(rawData)); } catch (URISyntaxException e) { throw new AvpDataException(e, this); } catch (UnknownServiceException e) { throw new AvpDataException(e, this); } }
@Override public long getInteger64() throws AvpDataException { try { return parser.bytesToLong(rawData); } catch (Exception e) { throw new AvpDataException(e, this); } }
@Override public String getOriginHost() throws AvpDataException { Avp originHostAvp = message.getAvps().getAvp(ORIGIN_HOST); if (originHostAvp != null) { return originHostAvp.getDiameterIdentity(); } else { throw new AvpDataException("Avp ORIGIN_HOST not found"); } }
@Override public long getAuthApplicationId() throws AvpDataException { Avp authApplicationIdAvp = message.getAvps().getAvp(AUTH_APPLICATION_ID); if (authApplicationIdAvp != null) { return authApplicationIdAvp.getUnsigned32(); } else { throw new AvpDataException("Avp AUTH_APPLICATION_ID not found"); } }
@Override public int getReAuthRequestType() throws AvpDataException { Avp reAuthRequestTypeAvp = message.getAvps().getAvp(RE_AUTH_REQUEST_TYPE); if (reAuthRequestTypeAvp != null) { return reAuthRequestTypeAvp.getInteger32(); } else { throw new AvpDataException("Avp RE_AUTH_REQUEST_TYPE not found"); } } }
@Override public long getAccountingRecordNumber() throws AvpDataException { Avp accRecordNumberAvp = message.getAvps().getAvp(ACC_RECORD_NUMBER); if (accRecordNumberAvp != null) { return accRecordNumberAvp.getUnsigned32(); } else { throw new AvpDataException("Avp ACC_RECORD_NUMBER not found"); } } }
@Override public int getAccountingRecordType() throws AvpDataException { Avp accRecordTypeAvp = message.getAvps().getAvp(Avp.ACC_RECORD_TYPE); if (accRecordTypeAvp != null) { return accRecordTypeAvp.getInteger32(); } else { throw new AvpDataException("Avp ACC_RECORD_TYPE not found"); } }
@Override public int getAccountingRecordType() throws AvpDataException { Avp accRecordTypeAvp = message.getAvps().getAvp(Avp.ACC_RECORD_TYPE); if (accRecordTypeAvp != null) { return accRecordTypeAvp.getInteger32(); } else { throw new AvpDataException("Avp ACC_RECORD_TYPE not found"); } }
@Override public long getAccountingRecordNumber() throws AvpDataException { Avp accRecordNumberAvp = message.getAvps().getAvp(ACC_RECORD_NUMBER); if (accRecordNumberAvp != null) { return accRecordNumberAvp.getUnsigned32(); } else { throw new AvpDataException("Avp ACC_RECORD_NUMBER not found"); } }
@Override public int getAccountingRecordType() throws AvpDataException { Avp accRecordTypeAvp = message.getAvps().getAvp(Avp.ACC_RECORD_TYPE); if (accRecordTypeAvp != null) { return accRecordTypeAvp.getInteger32(); } else { throw new AvpDataException("Avp ACC_RECORD_TYPE not found"); } }
@Override public long getAccountingRecordNumber() throws AvpDataException { Avp accRecordNumberAvp = message.getAvps().getAvp(ACC_RECORD_NUMBER); if (accRecordNumberAvp != null) { return accRecordNumberAvp.getUnsigned32(); } else { throw new AvpDataException("Avp ACC_RECORD_NUMBER not found"); } } }