摘要: 概念: IO流用来处理设备之间的数据传输。 Java对数据的操作是通过流的方式。 JAVA用于操作流的类都在IO包中。 流按流向分为两种:输入流、输出流。 流按操作类型分为两种: 字节流:字节流可以操作任何数据,因为在计算机中任何数据都是以字节的形式存储的。 字符流:字符流只能操作纯字符数据,比较方 阅读全文
posted @ 2020-05-28 22:26 一块 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 过滤器接口: public interface FilenameFilter { boolean accept(File dir, String name); } 使用: File dir = new File("E:\\"); String[] arr = dir.list(new Filenam 阅读全文
posted @ 2020-05-28 22:09 一块 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 需求:判断E盘目录下是否有后缀名为.jpg的文件,如果有就输出该文件名称。 File dir = new File("E:\\"); 方法一: String [] arr = dir.list(); //获取e盘下所有的文件或文件夹 for(String string : arr){ if(stri 阅读全文
posted @ 2020-05-28 21:28 一块 阅读(428) 评论(0) 推荐(0) 编辑