/** * Return an IA5 string from the passed in object * * @param obj a DERIA5String or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERIA5String instance, or null. */ public static DERIA5String getInstance( Object obj) { if (obj == null || obj instanceof DERIA5String) { return (DERIA5String)obj; } if (obj instanceof byte[]) { try { return (DERIA5String)fromByteArray((byte[])obj); } catch (Exception e) { throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); } } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
/** * return a IA5 string from the passed in object * * @param obj a DERIA5String or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERIA5String instance, or null. */ public static DERIA5String getInstance( Object obj) { if (obj == null || obj instanceof DERIA5String) { return (DERIA5String)obj; } if (obj instanceof byte[]) { try { return (DERIA5String)fromByteArray((byte[])obj); } catch (Exception e) { throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); } } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }