Code example for BufferedInputStream

0
        if (!file.isFile()) {
            return null; 
        } 
        InputStream is = null;
        try { 
            is = new BufferedInputStream(new FileInputStream(file));
            return (X509Certificate) CERT_FACTORY.generateCertificate(is);
        } catch (IOException e) {
            return null; 
        } catch (CertificateException e) {
            // reading a cert while its being installed can lead to this. 
            // just pretend like its not available yet. 
            return null; 
        } finally { 
            IoUtils.closeQuietly(is);
        } 
    } 
 
    private void writeCertificate(File file, X509Certificate cert)
            throws IOException, CertificateException { 
        File dir = file.getParentFile();