File file = new File(dirPath); if (!file.exists()) { file.mkdirs(); }…
if (file.exists()) { 来判断这是不是一个文件. file.isDirectory() 来判断这是不是一个文件夹. 1.File testFile = new File(testFilePath);if(!testFile .exists()) { testFile.mkdirs(); System.out.println("测试文件夹不存在");}2.File testFile = new File(testFilePath);if(!testFile .exist…
Java判断指定日期是否为工作日 转自:https://www.jianshu.com/p/966659492f2f 转:https://www.jianshu.com/p/05ccb5783f65转:https://www.jianshu.com/p/99931a7a4f0d获取指定日期的节假日信息: http://api.goseek.cn/ package com.juqitech.zb.common.util; import net.sf.json.JSONObject; import…
之前用jdk7的WatchService API(java.nio.file包)来做目录下的子文件监控,后改为使用commons-io包.主要有下面几点不同:1. WatchService是采用扫描式的,效率低,commons-io是使用事件驱动的,效率高:2. WatchService代码写起来费劲 3.  WatchService不能监听到孙文件目录(多级目录),事先父文件夹需要存在,而FileAlterationObserver可以监听多级目录,父目录事先不存在也没问题.http://co…
判断字符串为空和判断集合是否为空用到依赖,也可以改成自己的方式 <!-- Spring Web --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>5.2.12.RELEASE</version> </dependency> /** * 判断指定url…
java.io.File.listFiles(FilenameFilter filter) 返回抽象路径名数组,表示在目录中此抽象路径名表示,满足指定过滤器的文件和目录. 声明 以下是java.io.File.listFiles(FilenameFilter filter)方法的声明: public File[] listFiles(FilenameFilter filter) 参数 filter - 文件名过滤器 返回值 该方法返回抽象路径名数组,表示在目录中此抽象路径名表示,满足指定过滤器的…
第一种方案: /** * 是否创建目录 * @param path * @return */ public boolean isexitsPath(String path)throws InterruptedException{ String [] paths=path.split("\\\\"); StringBuffer fullPath=new StringBuffer(); for (int i = 0; i < paths.length; i++) { fullPath…
private static Map<String, Object> loadAllJarFromAbsolute(String directoryPath) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IOException { File directory = new File(directoryPath); // 判断是否为文件夹,如果是文件,直接用单个jar解析的方法去…
https://www.cnblogs.com/jhao/p/7243043.html…
这个和WINDOWS创建RTF文件一样 public void CreateRtfFile(string RtfFileName) { RichTextBox richTextBox1 = new RichTextBox(); richTextBox1.SaveFile(RtfFileName); } private void button1_Click(object sender, EventArgs e) { string Dir = @"C:\Users\Admin\Desktop\&qu…