private final void checkAndCreateDirectories(File f, boolean needWritePermission) throws IOException {
		String dir = f.getAbsolutePath();

		// check if it exists and it is not a directory
		if (f.exists() && !f.isDirectory()) {
			throw new IOException("A none directory file with the same name as the configured directory '" + dir
				+ "' already exists.");
		}

		// try to create the directory
		if (!f.exists()) {
			if (!f.mkdirs()) {
				throw new IOException("Could not create the directory '" + dir + "'.");
			}
		}

		// check the read and execute permission
		if (!(f.canRead() && f.canExecute())) {
			throw new IOException("The directory '" + dir + "' cannot be read and listed.");
		}

		// check the write permission
		if (needWritePermission && !f.canWrite()) {
			throw new IOException("No write access could be obtained on directory '" + dir + "'.");
		}
	}
private final void checkAndCreateDirectories ( File f , boolean needWritePermission ) throws IOException { String dir = f . getAbsolutePath ( ) ; if ( f . exists ( ) && ! f . isDirectory ( ) ) { throw new IOException ( "A none directory file with the same name as the configured directory '" + dir + "' already exists." ) ; } if ( ! f . exists ( ) ) { if ( ! f . mkdirs ( ) ) { throw new IOException ( "Could not create the directory '" + dir + "'." ) ; } } if ( ! ( f . canRead ( ) && f . canExecute ( ) ) ) { throw new IOException ( "The directory '" + dir + "' cannot be read and listed." ) ; } if ( needWritePermission && ! f . canWrite ( ) ) { throw new IOException ( "No write access could be obtained on directory '" + dir + "'." ) ; } }
Checks and creates the directory described by the abstract directory path. This function checks
if the directory exists and creates it if necessary. It also checks read permissions and
write permission, if necessary.

@param dir
The String describing the directory path.
@param needWritePermission
A flag indicating whether to check write access.
@throws IOException
Thrown, if the directory could not be created, or if one of the checks failed.