src/java.base/share/classes/sun/security/x509/PolicyInformation.java

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


 241      */
 242     public Enumeration<String> getElements() {
 243         AttributeNameEnumeration elements = new AttributeNameEnumeration();
 244         elements.addElement(ID);
 245         elements.addElement(QUALIFIERS);
 246 
 247         return elements.elements();
 248     }
 249 
 250     /**
 251      * Return the name of this attribute.
 252      */
 253     public String getName() {
 254         return NAME;
 255     }
 256 
 257     /**
 258      * Return a printable representation of the PolicyInformation.
 259      */
 260     public String toString() {
 261         StringBuilder s = new StringBuilder("  [" + policyIdentifier.toString());
 262         s.append(policyQualifiers + "  ]\n");
 263         return s.toString();
 264     }
 265 
 266     /**
 267      * Write the PolicyInformation to the DerOutputStream.
 268      *
 269      * @param out the DerOutputStream to write the extension to.
 270      * @exception IOException on encoding errors.
 271      */
 272     public void encode(DerOutputStream out) throws IOException {
 273         DerOutputStream tmp = new DerOutputStream();
 274         policyIdentifier.encode(tmp);
 275         if (!policyQualifiers.isEmpty()) {
 276             DerOutputStream tmp2 = new DerOutputStream();
 277             for (PolicyQualifierInfo pq : policyQualifiers) {
 278                 tmp2.write(pq.getEncoded());
 279             }
 280             tmp.write(DerValue.tag_Sequence, tmp2);
 281         }
 282         out.write(DerValue.tag_Sequence, tmp);
 283     }


 241      */
 242     public Enumeration<String> getElements() {
 243         AttributeNameEnumeration elements = new AttributeNameEnumeration();
 244         elements.addElement(ID);
 245         elements.addElement(QUALIFIERS);
 246 
 247         return elements.elements();
 248     }
 249 
 250     /**
 251      * Return the name of this attribute.
 252      */
 253     public String getName() {
 254         return NAME;
 255     }
 256 
 257     /**
 258      * Return a printable representation of the PolicyInformation.
 259      */
 260     public String toString() {
 261         return "  [" + policyIdentifier + policyQualifiers + "  ]\n";


 262     }
 263 
 264     /**
 265      * Write the PolicyInformation to the DerOutputStream.
 266      *
 267      * @param out the DerOutputStream to write the extension to.
 268      * @exception IOException on encoding errors.
 269      */
 270     public void encode(DerOutputStream out) throws IOException {
 271         DerOutputStream tmp = new DerOutputStream();
 272         policyIdentifier.encode(tmp);
 273         if (!policyQualifiers.isEmpty()) {
 274             DerOutputStream tmp2 = new DerOutputStream();
 275             for (PolicyQualifierInfo pq : policyQualifiers) {
 276                 tmp2.write(pq.getEncoded());
 277             }
 278             tmp.write(DerValue.tag_Sequence, tmp2);
 279         }
 280         out.write(DerValue.tag_Sequence, tmp);
 281     }