/** * Finds an attribute with the specified ID within given attribute list. * * @param attributes the attribute list to search * @param ID the ID of the attribute to search for * @return an attribute with given ID found in the attribute list, or null if no such attribute * exists */ public static Attr findAttr(List<Attr> attributes, int ID) { Attr attr = null; for (int i = 0; attributes != null && i < attributes.size(); i++) { attr = (Attr) attributes.get(i); if (attr.getID() == ID) return attr; } return null; }
public static Date getAttrDate(Message message, int id) { try { Attr attr = message.getAttribute(id); if (attr != null && attr.getValue() instanceof Date) { return (Date) attr.getValue(); } } catch (IOException e) { } return null; }
public static String getAttrString(Message message, int id) { try { Attr attr = message.getAttribute(id); if (attr != null) { return clear(toString(attr.getValue()), true); } } catch (IOException e) { } return null; }