use of org.jdiameter.api.AvpDataException in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsDiameterIdentity.
public static DiameterIdentity[] getAvpsAsDiameterIdentity(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
DiameterIdentity[] values = new DiameterIdentity[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = new DiameterIdentity(avp.getDiameterIdentity());
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type DiameterIdentity.", e);
}
return new DiameterIdentity[0];
}
}
use of org.jdiameter.api.AvpDataException in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsOctetString.
public static byte[][] getAvpsAsOctetString(int avpCode, long vendorId, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode, vendorId);
byte[][] values = new byte[avpSet.size()][];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getOctetString();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type OctetString.", e);
}
return new byte[0][];
}
}
use of org.jdiameter.api.AvpDataException in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsFloat32.
public static float[] getAvpsAsFloat32(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
float[] values = new float[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getFloat32();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type Float32.", e);
}
return new float[0];
}
}
use of org.jdiameter.api.AvpDataException in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsUTF8String.
public static String[] getAvpsAsUTF8String(int avpCode, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode);
String[] values = new String[avpSet.size()];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getUTF8String();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " as type UTF8String.", e);
}
return new String[0];
}
}
use of org.jdiameter.api.AvpDataException in project jain-slee.diameter by RestComm.
the class AvpUtilities method getAvpsAsRaw.
public static byte[][] getAvpsAsRaw(int avpCode, long vendorId, AvpSet set) {
try {
AvpSet avpSet = set.getAvps(avpCode, vendorId);
byte[][] values = new byte[avpSet.size()][];
int i = 0;
for (Avp avp : avpSet) {
values[i++] = avp.getRaw();
}
return values;
} catch (AvpDataException e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Raw.", e);
}
return new byte[0][];
}
}
Aggregations