/** * Constructor with optional validation. * * @param string the base string to wrap. * @param validate whether or not to check the string. * @throws IllegalArgumentException if validate is true and the string * contains characters that should not be in an IA5String. */ public DERIA5String( String string, boolean validate) { if (string == null) { throw new NullPointerException("string cannot be null"); } if (validate && !isIA5String(string)) { throw new IllegalArgumentException("string contains illegal characters"); } this.string = Strings.toByteArray(string); }
/** * Constructor with optional validation. * * @param string the base string to wrap. * @param validate whether or not to check the string. * @throws IllegalArgumentException if validate is true and the string * contains characters that should not be in an IA5String. */ public DERIA5String( String string, boolean validate) { if (string == null) { throw new NullPointerException("string cannot be null"); } if (validate && !isIA5String(string)) { throw new IllegalArgumentException("string contains illegal characters"); } this.string = Strings.toByteArray(string); }