public String toString() { return getString(); }
/** * Return a Visible String from the passed in object. * * @param obj a DERVisibleString or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERVisibleString instance, or null */ public static DERVisibleString getInstance( Object obj) { if (obj == null || obj instanceof DERVisibleString) { return (DERVisibleString)obj; } if (obj instanceof byte[]) { try { return (DERVisibleString)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 Visible String from a tagged object. * * @param obj the tagged object holding the object we want * @param explicit true if the object is meant to be explicitly * tagged false otherwise. * @exception IllegalArgumentException if the tagged object cannot * be converted. * @return a DERVisibleString instance, or null */ public static DERVisibleString getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERVisibleString) { return getInstance(o); } else { return new DERVisibleString(ASN1OctetString.getInstance(o).getOctets()); } }
break; case CONTENT_TYPE_VISIBLESTRING: contents = new DERVisibleString(text); break; case CONTENT_TYPE_BMPSTRING:
/** * Return a Visible String from a tagged object. * * @param obj the tagged object holding the object we want * @param explicit true if the object is meant to be explicitly * tagged false otherwise. * @exception IllegalArgumentException if the tagged object cannot * be converted. * @return a DERVisibleString instance, or null */ public static DERVisibleString getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERVisibleString) { return getInstance(o); } else { return new DERVisibleString(ASN1OctetString.getInstance(o).getOctets()); } }
break; case CONTENT_TYPE_VISIBLESTRING: contents = new DERVisibleString(text); break; case CONTENT_TYPE_BMPSTRING:
public String toString() { return getString(); }
return new DERUTF8String(defIn.toByteArray()); case VISIBLE_STRING: return new DERVisibleString(defIn.toByteArray()); default: throw new IOException("unknown tag " + tagNo + " encountered");
/** * Return a Visible String from the passed in object. * * @param obj a DERVisibleString or an object that can be converted into one. * @exception IllegalArgumentException if the object cannot be converted. * @return a DERVisibleString instance, or null */ public static DERVisibleString getInstance( Object obj) { if (obj == null || obj instanceof DERVisibleString) { return (DERVisibleString)obj; } if (obj instanceof byte[]) { try { return (DERVisibleString)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()); }
buff.append( vstring.getString() );
return new DERUTF8String(defIn.toByteArray()); case VISIBLE_STRING: return new DERVisibleString(defIn.toByteArray()); case GRAPHIC_STRING: return new DERGraphicString(defIn.toByteArray());
buf.append(indent + "VisibleString(" + ((DERVisibleString)obj).getString() + ") " + nl);
buf.append(indent + "VisibleString(" + ((DERVisibleString)obj).getString() + ") " + nl);