src/java.base/share/classes/java/security/cert/PolicyQualifierInfo.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 141     /**
 142      * Returns the ASN.1 DER encoded form of the {@code qualifier}
 143      * field of this {@code PolicyQualifierInfo}.
 144      *
 145      * @return the ASN.1 DER encoded bytes of the {@code qualifier}
 146      * field. Note that a copy is returned, so the data is cloned each
 147      * time this method is called.
 148      */
 149     public final byte[] getPolicyQualifier() {
 150         return (mData == null ? null : mData.clone());
 151     }
 152 
 153     /**
 154      * Return a printable representation of this
 155      * {@code PolicyQualifierInfo}.
 156      *
 157      * @return a {@code String} describing the contents of this
 158      *         {@code PolicyQualifierInfo}
 159      */
 160     public String toString() {
 161         if (pqiString != null)
 162             return pqiString;

 163         HexDumpEncoder enc = new HexDumpEncoder();
 164         StringBuilder sb = new StringBuilder();
 165         sb.append("PolicyQualifierInfo: [\n");
 166         sb.append("  qualifierID: " + mId + "\n");
 167         sb.append("  qualifier: " +
 168             (mData == null ? "null" : enc.encodeBuffer(mData)) + "\n");
 169         sb.append("]");

 170         pqiString = sb.toString();
 171         return pqiString;
 172     }
 173 }


 141     /**
 142      * Returns the ASN.1 DER encoded form of the {@code qualifier}
 143      * field of this {@code PolicyQualifierInfo}.
 144      *
 145      * @return the ASN.1 DER encoded bytes of the {@code qualifier}
 146      * field. Note that a copy is returned, so the data is cloned each
 147      * time this method is called.
 148      */
 149     public final byte[] getPolicyQualifier() {
 150         return (mData == null ? null : mData.clone());
 151     }
 152 
 153     /**
 154      * Return a printable representation of this
 155      * {@code PolicyQualifierInfo}.
 156      *
 157      * @return a {@code String} describing the contents of this
 158      *         {@code PolicyQualifierInfo}
 159      */
 160     public String toString() {
 161         if (pqiString != null) {
 162             return pqiString;
 163         }
 164         HexDumpEncoder enc = new HexDumpEncoder();
 165         StringBuilder sb = new StringBuilder();
 166         sb.append("PolicyQualifierInfo: [\n");
 167         sb.append("  qualifierID: ").append(mId).append('\n');
 168         sb.append("  qualifier: ")
 169                 .append(mData == null ? "null" : enc.encodeBuffer(mData))
 170                 .append('\n');
 171         sb.append(']');
 172         pqiString = sb.toString();
 173         return pqiString;
 174     }
 175 }