@Test public void testForceMkdir() { final File directory = new File(TEST_DIRECTORY + File.separator + "dir1" + File.separator + "dir2"); Assert.assertFalse(directory.exists()); try { FileHelper.forceMkdir(directory); Assert.assertTrue(directory.exists()); Assert.assertTrue(directory.isDirectory()); } catch (final IOException e) { Assert.fail(e.getMessage()); } }
public static void forceMkdir(final File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { final String message = "File " + directory + " exists and is " + "not a directory. Unable to create directory."; throw new IOException(message); } } else { if (!directory.mkdirs()) { final String message = "Unable to create directory " + directory; throw new IOException(message); } } }
FileHelper { public static void forceMkdir(final File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { final String message = "File " + directory + " exists and is " + "not a directory. Unable to create directory."; throw new IOException(message); } } else { if (!directory.mkdirs()) { final String message = "Unable to create directory " + directory; throw new IOException(message); } } } }
FileHelper { public static void forceMkdir(final File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { final String message = "File " + directory + " exists and is " + "not a directory. Unable to create directory."; throw new IOException(message); } } else { if (!directory.mkdirs()) { final String message = "Unable to create directory " + directory; throw new IOException(message); } } } private  FileHelper(); }
FileHelper { public static void forceMkdir(final File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { final String message = "File " + directory + " exists and is " + "not a directory. Unable to create directory."; throw new IOException(message); } } else { if (!directory.mkdirs()) { final String message = "Unable to create directory " + directory; throw new IOException(message); } } } private  FileHelper(); static void createEmptyFile(final File file); static int folderSize(File directory, boolean recursive); static void doCopyFile(final File srcFile, final File destFile); static void forceDelete(final File file); static void forceMkdir(final File directory); static void moveDirectory(final File srcDir, final File destDir); static String[] parseContentFile(final File contentFile); static void writeStringToFile(final File file, final String data,
			final Charset encoding, final boolean append); static boolean unzipFile(String zipname, String destDir); static int getFileSizeInMb(File downloadedFile); static int getCountFiles(File fileToCheck); }
FileHelper { public static void forceMkdir(final File directory) throws IOException { if (directory.exists()) { if (directory.isFile()) { final String message = "File " + directory + " exists and is " + "not a directory. Unable to create directory."; throw new IOException(message); } } else { if (!directory.mkdirs()) { final String message = "Unable to create directory " + directory; throw new IOException(message); } } } private  FileHelper(); static void createEmptyFile(final File file); static int folderSize(File directory, boolean recursive); static void doCopyFile(final File srcFile, final File destFile); static void forceDelete(final File file); static void forceMkdir(final File directory); static void moveDirectory(final File srcDir, final File destDir); static String[] parseContentFile(final File contentFile); static void writeStringToFile(final File file, final String data,
			final Charset encoding, final boolean append); static boolean unzipFile(String zipname, String destDir); static int getFileSizeInMb(File downloadedFile); static int getCountFiles(File fileToCheck); static final long ONE_KB; static final long ONE_MB; }