![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
IO
金肴羽
付出总有收获,努力终将成功。
展开
-
Java::IO流-转换流
Java::IO流-转换流备注:主要可以用于不同编码之间的文件转换。public void testBuffered() throws Exception { FileInputStream fis = new FileInputStream("bef.txt"); FileOutputStream fos = new FileOutputStream("aft.txt"); InputStreamReader isr = new InputStreamReader(fis, "GB原创 2021-09-16 10:27:34 · 58 阅读 · 0 评论 -
Java::IO流-文件流
Java::IO流-文件流1.写入示例2.读取示例3.注意点1.写入示例FileWriter fw = null;try { fw = new FileWriter(new File("E:\\Test.txt")); fw.write("atguigu-songhongkang");} catch (IOException e) { e.printStackTrace();} finally { if (fw != null) try { fw.close(); } ca原创 2021-09-15 16:54:14 · 63 阅读 · 0 评论 -
Java::IO流-File 类的使用篇
Java::File 类的使用1.常用构造器1.1 public File(String pathname)1.2 public File(String parent,String child)1.3 public File(File parent,String child)2.路径分隔符2.1 路径分隔符和系统有关:2.1.2 File类提供了一个常量:separator3.常用方法3.1 File类的获取3.2 File类的重命名3.3 File类的判断3.4 File类的创建3.5 File类的删除原创 2021-09-10 11:48:00 · 81 阅读 · 0 评论 -
Java中删除指定文件目录及其下的所有文件
代码示例:public static void main(String[] args) throws Exception { File file1 = new File("E:/IOTest/dir1"); deleteFile(file1); } private static void deleteFile(File file) throws IOException { //判断是否存在此文件 if (file.exis原创 2021-09-13 18:02:18 · 1725 阅读 · 0 评论