Here you can find the source of forceMkdir(File directory)
Parameter | Description |
---|---|
directory | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void forceMkdir(File directory) throws IOException
//package com.java2s; /**//from w w w . j av a2s . c o m * Distributed under GNU GENERAL PUBLIC LICENSE Version 3 * * @author Dmitry.Bedrin@gmail.com */ import java.io.File; import java.io.IOException; public class Main { /** * @param directory * @throws IOException */ public static void forceMkdir(File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { throw new IOException( "File " + directory + " exists and is not a directory. Unable to create directory."); } } else { if (!directory.mkdirs()) { throw new IOException("Unable to create directory " + directory); } } } }