This commit is contained in:
xiangwbs
2018-03-08 23:44:04 +08:00
parent b34592cb2a
commit cd8665810a
2 changed files with 5 additions and 12 deletions
@@ -1,7 +1,5 @@
package com.xwbing.demo;
import org.springframework.core.io.ClassPathResource;
import java.io.*;
/**
@@ -96,14 +94,5 @@ public class IODemo {
PrintWriter pw1 = new PrintWriter(osw, true);///////当第一个参数为流,可以使用第二个参数来指定是否自动flush
pw1.println("......");
pw1.close();
/**
* 读取文件
*/
String filePath = IODemo.class.getResource("/redis.properties").getPath();
InputStream in = IODemo.class.getResourceAsStream("/redis.properties");
ClassPathResource pic = new ClassPathResource("file");
String absolutePath = pic.getFile().getAbsolutePath();
}
}