/** * return a Numeric string from the passed in object * * @param obj a DERNumericString or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERNumericString instance, or null */ public static DERNumericString getInstance( Object obj) { if (obj == null || obj instanceof DERNumericString) { return (DERNumericString)obj; } if (obj instanceof byte[]) { try { return (DERNumericString)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 Numeric string from the passed in object * * @param obj a DERNumericString or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERNumericString instance, or null */ public static DERNumericString getInstance( Object obj) { if (obj == null || obj instanceof DERNumericString) { return (DERNumericString)obj; } if (obj instanceof byte[]) { try { return (DERNumericString)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()); }