src/share/classes/java/security/cert/CertificateFactory.java

Print this page

        

*** 63,83 **** * supports those methods), so that each call to * <code>generateCertificate</code> consumes only one certificate, and the * read position of the input stream is positioned to the next certificate in * the file:<p> * ! * <pre> * FileInputStream fis = new FileInputStream(filename); * BufferedInputStream bis = new BufferedInputStream(fis); * * CertificateFactory cf = CertificateFactory.getInstance("X.509"); * * while (bis.available() > 0) { * Certificate cert = cf.generateCertificate(bis); * System.out.println(cert.toString()); * } ! * </pre> * * <p>The following example parses a PKCS#7-formatted certificate reply stored * in a file and extracts all the certificates from it:<p> * * <pre> --- 63,83 ---- * supports those methods), so that each call to * <code>generateCertificate</code> consumes only one certificate, and the * read position of the input stream is positioned to the next certificate in * the file:<p> * ! * <pre>{@code * FileInputStream fis = new FileInputStream(filename); * BufferedInputStream bis = new BufferedInputStream(fis); * * CertificateFactory cf = CertificateFactory.getInstance("X.509"); * * while (bis.available() > 0) { * Certificate cert = cf.generateCertificate(bis); * System.out.println(cert.toString()); * } ! * }</pre> * * <p>The following example parses a PKCS#7-formatted certificate reply stored * in a file and extracts all the certificates from it:<p> * * <pre>