protected void create(File file) throws IOException {
        if(!file.exists()) {
            File dir = file.getParentFile();
            if(dir.exists()) file.createNewFile();
            else if(dir.mkdirs()) file.createNewFile();
            else throw new IOException("Failed to create " + file.getAbsolutePath());
        }
        
        if(file.isDirectory()) {
            throw new IOException("Cannot open directory " + file.getAbsolutePath());
        }
    }
protected void create ( File file ) throws IOException { if ( ! file . exists ( ) ) { File dir = file . getParentFile ( ) ; if ( dir . exists ( ) ) file . createNewFile ( ) ; else if ( dir . mkdirs ( ) ) file . createNewFile ( ) ; else throw new IOException ( "Failed to create " + file . getAbsolutePath ( ) ) ; } if ( file . isDirectory ( ) ) { throw new IOException ( "Cannot open directory " + file . getAbsolutePath ( ) ) ; } }
Creates the specified file if needed.

@throws IOException