Code example for File

Methods: getParentFile, mkdirs, setExecutable, setReadable

0
        } 
    } 
 
    private void writeCertificate(File file, X509Certificate cert)
            throws IOException, CertificateException { 
        File dir = file.getParentFile();
        dir.mkdirs();
        dir.setReadable(true, false);
        dir.setExecutable(true, false);
        OutputStream os = null;
        try { 
            os = new FileOutputStream(file);
            os.write(cert.getEncoded());
        } finally { 
            IoUtils.closeQuietly(os);
        } 
        file.setReadable(true, false);
    } 
 
    private boolean isDeletedSystemCertificate(X509Certificate x) {
        return getCertificateFile(deletedDir, x).exists();
    }