@Test public void touch() { FileUtils.touch("/tmp/a/6/a.log"); File file = new File("/tmp/a/6/a.log"); assertTrue(file.exists()); assertTrue(file.isFile()); assertEquals(3, FileUtils.delete(new File("/tmp/a"))); }
public void touch(File file) { if (file == null) { return; } if (!file.exists()) { mkdirsForFile(file); try { if (!file.createNewFile()) { throw Exceptions.fail("touch file fail"); } log.info("file [{}] created", file); } catch (IOException e) { throw Exceptions.wrap(e); } } else { log.info("file [{}] exists", file); } }
FileUtils { public void touch(File file) { if (file == null) { return; } if (!file.exists()) { mkdirsForFile(file); try { if (!file.createNewFile()) { throw Exceptions.fail("touch file fail"); } log.info("file [{}] created", file); } catch (IOException e) { throw Exceptions.wrap(e); } } else { log.info("file [{}] exists", file); } } }
FileUtils { public void touch(File file) { if (file == null) { return; } if (!file.exists()) { mkdirsForFile(file); try { if (!file.createNewFile()) { throw Exceptions.fail("touch file fail"); } log.info("file [{}] created", file); } catch (IOException e) { throw Exceptions.wrap(e); } } else { log.info("file [{}] exists", file); } }  }
FileUtils { public void touch(File file) { if (file == null) { return; } if (!file.exists()) { mkdirsForFile(file); try { if (!file.createNewFile()) { throw Exceptions.fail("touch file fail"); } log.info("file [{}] created", file); } catch (IOException e) { throw Exceptions.wrap(e); } } else { log.info("file [{}] exists", file); } }  void mkdirs(File dir); void mkdirs(Path path); void mkdirs(String path); void mkdirs(String parent, String... children); void mkdirsForFile(File file); void touch(File file); void touch(Path path); void touch(String filepath); String extension(String filename); int countFiles(File file); int countFiles(File file, Predicate<File> filter); int countDirs(File file); int countDirs(File file, Predicate<File> filter); String absolutePath(File file); boolean isSamePath(File file, File another); boolean isRoot(File dir); int delete(File file); int deleteFile(File file); int deleteDir(File file); File tempDir(); File tempBaseDir(); int cleanTempBaseDir(); File createTempDir(String first, String... children); String parseMimeType(String filename); String getMimeType(String extension); File download(String url); void download(String url, File file); }
FileUtils { public void touch(File file) { if (file == null) { return; } if (!file.exists()) { mkdirsForFile(file); try { if (!file.createNewFile()) { throw Exceptions.fail("touch file fail"); } log.info("file [{}] created", file); } catch (IOException e) { throw Exceptions.wrap(e); } } else { log.info("file [{}] exists", file); } }  void mkdirs(File dir); void mkdirs(Path path); void mkdirs(String path); void mkdirs(String parent, String... children); void mkdirsForFile(File file); void touch(File file); void touch(Path path); void touch(String filepath); String extension(String filename); int countFiles(File file); int countFiles(File file, Predicate<File> filter); int countDirs(File file); int countDirs(File file, Predicate<File> filter); String absolutePath(File file); boolean isSamePath(File file, File another); boolean isRoot(File dir); int delete(File file); int deleteFile(File file); int deleteDir(File file); File tempDir(); File tempBaseDir(); int cleanTempBaseDir(); File createTempDir(String first, String... children); String parseMimeType(String filename); String getMimeType(String extension); File download(String url); void download(String url, File file);  }