question: public static boolean isWritable ( final File file , final boolean makeDirs ) { if ( file == null ) { Log . e ( FileUtils . class , "isWritable(): Null or Empty parameter given" ) ; return false ; } final String fileParentDir = file . getParent ( ) ; if ( ! TextUtils . isEmpty ( fileParentDir ) ) { final File fileDir = new File ( fileParentDir ) ; if ( ! fileDir . exists ( ) ) { if ( makeDirs ) return makeDirsForFile ( file ) ; else return false ; } } boolean isWritable = true ; if ( file . exists ( ) ) isWritable = file . canWrite ( ) ; else { try { isWritable = file . createNewFile ( ) ; } catch ( IOException e ) { } if ( isWritable ) isWritable = file . delete ( ) ; } return isWritable ; }
target:  Method checks if file could be written/deleted or created. Method will create path/mkdirs if makeDirs set to true and file's path doesn't exists.