Code example for File

Methods: canWrite, isDirectory

0
    synchronized File getCacheDir() throws FileNotFoundException {
        File cacheDir = null;
        if (app != null)
            cacheDir = app.getCacheDir();
         
        if (cacheDir == null || !cacheDir.isDirectory() || !cacheDir.canWrite())
            throw new FileNotFoundException("Failed to find the cache directory. " + adviseToSetApp());
                     
        return cacheDir;
    } 
    @Override 
    public synchronized ClassDefiner getClassDefiner(ClassDefiner defaultDefiner, ClassLoader parentClassLoader) {
        if (classDefiner == null)
            try { 
                classDefiner = new AndroidClassDefiner(getCacheDir(), parentClassLoader);
            } catch (IOException ex) {
                throw new RuntimeException("Failed to instantiate the Android class definer : " + ex, ex);
            } 
        return classDefiner;
    }