18 File(18-19)

IO:对硬盘的文件进行读写
File:对(文件/文件夹)进行创建,删除等,表示要读写的(文件/文件夹)在哪

18.1 File构造方法

方法名 说明
File​(String pathname) 通过将给定的路径名字符串转换为抽象路径名来创建新的 File实例
File​(String parent, String child) 从父路径名字符串和子路径名字符串创建新的 File实例
File​(File parent, String child) 从父抽象路径名和子路径名字符串创建新的 File实例
public static void main(String[] args) {//      将字符串转换为抽象路径名来创建新的File实例String path = "D:\\atest\\a.txt"; // D:\atest\a.txtFile file = new File(path);System.out.println(file);//      拼接两个字符串为一个抽象路径名String path1 = "D:\\atest";String path2 = "b.txt";File file1 = new File(path1,path2);//把两个路径拼接.System.out.println(file1);//D:\atest\b.txt//      拼接 file + 字符串为一个抽象路径名File file2 = new File("D:\\atest");String path3 = "c.txt";File file3 = new File(file2,path3);System.out.println(file3); //D:\atest\c.txt}

18.2 绝对路径和相对路径

绝对路径:从盘符开始
相对路径:相对当前项目下的路径

public static void main(String[] args) {//这个路径固定不变了.File file = new File("D:\\itheima\\a.txt");//当前项目下的a.txtFile file2 = new File("a.txt");//当前项目下 --- 指定模块下的 a.txtFile file3 = new File("filemodule\\a.txt");}

18.3 File成员方法

创建文件/文件夹

方法名 说明
public boolean createNewFile() 创建一个新的空的文件
public boolean mkdirs() 创建一个单级/多级文件夹
public static void main(String[] args) throws IOException {File file = new File("D:\\atest\\c.txt");
//      createNewFile 注意:
//        1.文件夹路径必需存在,如果不存在,例如atest没有提前创建,就会报错
//        2.a.txt不存在,可以创建成功,返回true。如果已存在,创建失败,返回false(不光判断文件,还是跟文件夹名判断)
//        3.不管有没有后缀名,只能创建文件.不会创建文件夹。//        boolean res = file.createNewFile();
//        System.out.println(res);//      mkdirs 注意点:
//        1.可以创建单级文件夹,也可以创建多级文件夹
//        2.不管调用者有没有后缀名,只能创建文件夹
//        3.如果文件名跟最后的路径名重复,也是会创建失败的,返回false。createNewFile也一样boolean res2 = file.mkdirs();System.out.println(res2);}

删除文件/文件夹

方法名 说明
public boolean delete​() 删除由此抽象路径名表示的文件或目录
public static void main(String[] args) {//删除文件File file = new File("D:\\atest\\a.txt");boolean res = file.delete();System.out.println(res);
//         删除空白文件夹File file2 = new File("D:\\atest\\b");boolean res2 = file2.delete();System.out.println(res2);// 删除带文件的文件夹File file3 = new File("D:\\atest\\c");boolean res3 = file3.delete(); // falseSystem.out.println(res3);// 删除带空白文件夹的文件夹File file4 = new File("D:\\atest\\c");boolean res4 = file4.delete(); // falseSystem.out.println(res4);}

判断和获取功能

方法名 说明
public boolean isDirectory() 测试此抽象路径名表示的File是否为目录
public boolean isFile() 测试此抽象路径名表示的File是否为文件
public boolean exists() 测试此抽象路径名表示的File(文件/文件夹)是否存在
public String getAbsolutePath() 返回此抽象路径名的绝对路径名字符串
public String getPath() 将此抽象路径名转换为路径名字符串
public String getName() 返回由此抽象路径名表示的文件(文件+后缀格式)或目录的名称
public File[] listFiles() 返回此抽象路径名表示的目录中的文件和目录的File对象数组

listFiles 方法注意事项

  1. 当调用者不存在时,返回null
  2. 当调用者是一个文件时,返回null
  3. 当调用者是一个空文件夹时,返回一个长度为0的数组
  4. 当调用者是一个有内容的文件夹时,将里面所有文件和文件夹的路径放在File数组中返回
  5. 当调用者是一个有隐藏文件的文件夹时,将里面所有文件和文件夹的路径放在File数组中返回,包含隐藏内容
  6. 当调用者是一个需要权限才能进入的文件夹时,返回null
public static void main(String[] args) {File file = new File("D:\\atest");File[] files = file.listFiles(); //返回值是一个File类型的数组System.out.println(files.length);for (File path : files) {System.out.println(path);}}

18.4 实用方法

删除带文件的文件夹

public class Test2 {public static void main(String[] args) {//练习二:删除一个多级文件夹//delete方法//只能删除文件和空文件夹.//如果现在要删除一个有内容的文件夹?//先删掉这个文件夹里面所有的内容.//最后再删除这个文件夹File src = new File("C:\\Users\\apple\\Desktop\\src");deleteDir(src);}private static void deleteDir(File src) {//先删掉这个文件夹里面所有的内容.//1.进入 --- 得到src文件夹里面所有内容的File对象.File[] files = src.listFiles();//2.遍历 --- 因为我想得到src文件夹里面每一个文件和文件夹的File对象.for (File file : files) {if(file.isFile()){//3.判断 --- 如果遍历到的File对象是一个文件,那么直接删除file.delete();}else{//4.判断//递归deleteDir(file);//参数一定要是src文件夹里面的文件夹File对象}}//最后再删除这个文件夹src.delete();}}

统计文件类型的个数

public class Test3 {public static void main(String[] args) {//统计一个文件夹中,每种文件出现的次数.//统计 --- 定义一个变量用来统计. ---- 弊端:同时只能统计一种文件//利用map集合进行数据统计,键 --- 文件后缀名  值 ----  次数File file = new File("filemodule"); // filemodule模块名HashMap<String, Integer> hm = new HashMap<>();getCount(hm, file);System.out.println(hm);}private static void getCount(HashMap<String, Integer> hm, File file) {File[] files = file.listFiles();for (File f : files) {if(f.isFile()){String fileName = f.getName();String[] fileNameArr = fileName.split("\\.");if(fileNameArr.length == 2){String fileEndName = fileNameArr[1];if(hm.containsKey(fileEndName)){//已经存在//将已经出现的次数获取出来Integer count = hm.get(fileEndName);//这种文件又出现了一次.count++;//把已经出现的次数给覆盖掉.hm.put(fileEndName,count);}else{//不存在//表示当前文件是第一次出现hm.put(fileEndName,1);}}}else{getCount(hm,f);}}}
}

19 IO

19.1 概念

I 表示intput,是数据从硬盘进内存的过程,称之为
O 表示output,是数据从内存到硬盘的过程。称之为

所谓的读写,都是以内存为参照物,内存在读,内存在写。

io流读/写数据

读数据:内存读硬盘里的数据(输入流
写数据:内存把数据写到硬盘中(输出流

io流分类

19.2 字节流

1. 写数据

1.创建字节输出流对象

  • 注意点:
    如果文件不存在,会帮我们自动创建出来.
    如果文件存在,会把文件清空.

2.写数据

  • void write​(int b): 一次写一个字节数据
  • void write​(byte[] b): 一次写一个字节数组数据
  • void write​(byte[] b, int off, int len): 一次写一个字节数组的部分数据

3.释放资源

public static void main(String[] args) throws IOException {//1.创建字节输出流的对象 --- 告诉虚拟机我要往哪个文件中写数据了// 第二个参数就是续写开关,如果没有传递,默认就是false,// 如果第二个参数为true,表示打开续写功能,那么创建对象的这行代码不会清空文件.FileOutputStream fos = new FileOutputStream("D:\\a.txt",true);//FileOutputStream fos = new FileOutputStream(new File("D:\\a.txt")); // 两个效果一样//2,写数据// 这里的整数,实际写出的是整数在码表上对应的字母。fos.write(97); // 写入的是字节数据fos.write("\r\n".getBytes()); // 换行byte [] bys = {97,98,99,100,101,102,103};fos.write(bys,1,2); // 写入多个字节,可以传byte数组,也可以写多个值//3,释放资源fos.close();}

字节流写数据的异常处理(try…catch…finally)

public static void main(String[] args) {FileOutputStream fos = null;try {//System.out.println(2/0);fos = new FileOutputStream("D:\\a.txt");fos.write(97);}catch(IOException e){e.printStackTrace();}finally {//finally语句里面的代码,一定会被执行.if(fos != null){try {fos.close();} catch (IOException e) {e.printStackTrace();}}}}

2. 读数据

1.创建字节输入流对象

  • 注意点:
    如果文件不存在,会直接报错.

2.读数据

  • public int read​(): 一次读取一个字节,返回值就是本次读到的那个字节数据.
  • public int read​(byte[] b):从输入流读取最多b.length个字节的数据

3.释放资源

基本使用

public static void main(String[] args) throws IOException {//如果文件存在,那么就不会报错.//如果文件不存在,那么就直接报错.FileInputStream fis = new FileInputStream("bytestream\\a.txt");int read = fis.read();//一次读取一个字节,返回值就是本次读到的那个字节数据.//也就是字符在码表中对应的那个数字.//如果我们想要看到的是字符数据,那么一定要强转成charSystem.out.println((char)read);//释放资源fis.close();}

读多个字节

public static void main(String[] args) throws IOException {FileInputStream fis = new FileInputStream("bytestream\\a.txt");//1,文件中多个字节我怎么办?/*while(true){int i1 = fis.read();System.out.println(i1);}*/int b;while ((b = fis.read())!=-1){System.out.println((char) b);}fis.close();}

复制功能

public static void main(String[] args) throws IOException {//创建了字节输入流,准备读数据.FileInputStream fis = new FileInputStream("C:\\itheima\\a.avi");//创建了字节输出流,准备写数据.FileOutputStream fos = new FileOutputStream("bytestream\\a.avi");int b;while((b = fis.read())!=-1){fos.write(b);}fis.close();fos.close();}

提升复制速度的解决方案

public static void main(String[] args) throws IOException {FileInputStream fis = new FileInputStream("C:\\itheima\\a.avi");FileOutputStream fos = new FileOutputStream("bytestream\\a.avi");byte [] bytes = new byte[1024];int len; //本次读到的有效字节个数 -- 这次读了几个字节.while((len = fis.read(bytes))!=-1){fos.write(bytes,0,len);}fis.close();fos.close();}

19.3 字节缓冲流

主要是提升复制的效率

1. 复制数据(单个字节复制)

public static void method1() throws IOException {BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\itcast\\字节流复制图片.avi"));BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("myByteStream\\字节流复制图片.avi"));int by;while ((by=bis.read())!=-1) {bos.write(by);}bos.close();bis.close();}

2. 复制数据(字节数组复制)

public static void method2() throws IOException {BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\itcast\\字节流复制图片.avi"));BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("myByteStream\\字节流复制图片.avi"));byte[] bys = new byte[1024];int len;while ((len=bis.read(bys))!=-1) {bos.write(bys,0,len);}bos.close();bis.close();}

19.4 字符流

1. 编码表

重点:
windows默认使用码表为:GBK,一个字符个字节。
idea和以后工作默认使用UnicodeUTF-8编解码格式,一个中文个字节。

2. 编码和解码方法

编码

方法 说明
byte[] getBytes​() 使用平台的默认字符集将该 String编码为一系列字节,将结果存储到新的字节数组中
byte[] getBytes​(String charsetName) 使用指定的字符集将该 String编码为一系列字节,将结果存储到新的字节数组中

解码

方法 说明
String​(byte[] bytes) 通过使用平台的默认字符集解码指定的字节数组来构造新的 String
String​(byte[] bytes, String charsetName) 通过指定的字符集解码指定的字节数组来构造新的 String

3. 字符流

字符流 = 字节流 + 编码表
不管是在哪张码表中,中文的第一个字节一定是负数。

4. 字节流,字符流使用

1、想要进行拷贝,一律使用字节流或者字节缓冲流
2、想要把文件中的数据读到内存中打印或运算,请使用字符输入流
想要把集合,数组,键盘录入等数据写到文件中,请使用字符输出流
3、GBK码表一个中文个字节,UTF-8编码格式一个中文3个字节。

5. 写数据

1.创建字符输出流对象

  • 注意点:
    如果文件不存在,会帮我们自动创建出来.但是要保证父级路径存在。
    如果文件存在,会把文件清空.

2.写数据

  • void write​(int c) : 一次写一个字符数据
  • void write​(char[] cbuf): 一次写一个字符数组数据
  • void write​(char[] cbuf, int off, int len): 一次写一个字符数组的部分数据
  • void write​(String str): 一次写一个字符串,可以写中文
  • void write​(String str, int off, int len): 一次写一个字符串的部分数据,可以写中文

3.释放资源

  • flush(): 刷新流,还可以继续写数据。刷新流:相当于把内存此时的内容保存到硬盘中。
  • close(): 关闭流,释放资源,但是在关闭之前会先刷新流。一旦关闭,就不能再写数据
public static void main(String[] args) throws IOException {//创建字符输出流的对象FileWriter fw = new FileWriter("charstream\\a.txt");fw.write(97);char [] chars = {98,99,100,101};fw.write(chars);fw.write(chars,0,3);fw.write("黑马程序员abc");//刷新流,把上面的内容先保存一份到硬盘中fw.flush();fw.write("黑马程序员abc",0,2);//释放资源fw.close();}

6. 读数据

public static void main(String[] args) throws IOException {//创建字符输入流的对象// FileReader fr = new FileReader(new File("charstream\\a.txt"));FileReader fr = new FileReader("charstream\\a.txt");//读取数据//一次读取一个字符int ch;while((ch = fr.read()) != -1){System.out.println((char) ch);}//创建一个数组char [] chars = new char[1024];int len;//read方法还是读取,但是是一次读取多个字符//他把读到的字符都存入到chars数组。//返回值:表示本次读到了多少个字符。while((len = fr.read(chars))!=-1){System.out.println(new String(chars,0,len));}//释放资源fr.close();}

19.5 字符缓冲流

1. 读数据

public static void main(String[] args) throws IOException {//字符缓冲输入流BufferedReader br = new BufferedReader(new FileReader("charstream\\a.txt"));//读取数据char [] chars = new char[1024];int len;while((len = br.read(chars)) != -1){System.out.println(new String(chars,0,len));}br.close();}

2. 写数据

public static void main(String[] args) throws IOException {//字符缓冲输出流BufferedWriter bw = new BufferedWriter(new FileWriter("charstream\\a.txt"));//写出数据//实际写出的是97对应的字符abw.write(97);bw.write("\r\n");//实际写出的是97 - 101 对应的字符 abcdechar [] chars = {97,98,99,100,101};bw.write(chars);bw.write("\r\n");//实际写的是abcbw.write(chars,0,3);bw.write("\r\n");//会把字符串的内容原样写出bw.write("黑马程序员");bw.write("\r\n");//会把字符串的一部分写出 abcdeString line = "abcdefg";bw.write(line,0,5);bw.flush();bw.close();}

3. 字符缓冲流特有方法–newLine 跨平台的换行符

public static void main(String[] args) throws IOException {//字符缓冲流的特有功能//字符缓冲输出流BufferedWrite : newLine  跨平台的换行符//创建对象BufferedWriter bw = new BufferedWriter(new FileWriter("charstream\\a.txt"));//写出数据bw.write("黑马程序员666");//跨平台的回车换行bw.newLine();bw.write("abcdef");//跨平台的回车换行bw.newLine();bw.write("-------------");//刷新流bw.flush();//释放资源bw.close();}

4. 字符缓冲流特有方法–readLine 读一整行

public static void main(String[] args) throws IOException {//字符缓冲流的特有功能//字符缓冲输入流BufferedReader: readLine 读一整行//创建对象BufferedReader br = new BufferedReader(new FileReader("charstream\\a.txt"));//使用循环来进行改进String line;//可以读取一整行数据。一直读,读到回车换行为止。//但是他不会读取回车换行符。// readLine如果读不到数据返回nullwhile((line = br.readLine()) != null){System.out.println(line);}//释放资源br.close();}

19.6 字节流和字符流小结

19.7 转换流

转换流就是来进行字节流和字符流之间转换的

  • InputStreamReader是从字节流到字符流的桥梁
  • OutputStreamWriter是从字符流到字节流的桥梁
public static void main(String[] args) throws IOException {//method1();//method2();//在JDK11之后,字符流新推出了一个构造,也可以指定编码表FileReader fr = new FileReader("C:\\Users\\apple\\Desktop\\a.txt", Charset.forName("gbk"));int ch;while ((ch = fr.read())!=-1){System.out.println((char) ch);}fr.close();}private static void method2() throws IOException {//如何解决乱码现象//文件是什么码表,那么咱们就必须使用什么码表去读取.//我们就要指定使用GBK码表去读取文件.InputStreamReader isr = new InputStreamReader(new FileInputStream("C:\\Users\\apple\\Desktop\\a.txt"),"gbk");int ch;while((ch = isr.read())!=-1){System.out.println((char) ch);}isr.close();OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("C:\\Users\\apple\\Desktop\\b.txt"),"UTF-8");osw.write("我爱学习,谁也别打扰我");osw.close();}//这个方法直接读取会产生乱码//因为文件是GBK码表//而idea默认的是UTF-8编码格式.//所以两者不一致,导致乱码private static void method1() throws IOException {FileReader fr = new FileReader("C:\\Users\\apple\\Desktop\\a.txt");int ch;while ((ch = fr.read())!=-1){System.out.println((char) ch);}fr.close();}

19.8 对象操作流

可以把对象以字节的形式写到本地文件,直接打开文件,是读不懂的,需要再次用对象操作流读到内存中。

对象操作流分为两类:对象操作输入流对象操作输出流

  • 对象操作输出流(对象序列化流):就是将对象写到本地文件中,或者在网络中传输对象
  • 对象操作输入流(对象反序列化流):把写到本地文件中的对象读到内存中,或者接收网络中传输的对象

1. 读数据

public static void main(String[] args) throws IOException, ClassNotFoundException {ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));User o = (User) ois.readObject();System.out.println(o);ois.close();}

2. 写数据

public static void main(String[] args) throws IOException {User user = new User("zhangsan","qwer");ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("a.txt"));oos.writeObject(user);oos.close();}// 如果想要这个类的对象能被序列化,那么这个类必须要实现一个接口.Serializable
// User类
public class User implements Serializable {}

3. 注意:序列化对象后,修改了对象所属的JavaBean类

问题:此时会出问题,会抛出InvalidClassException异常.
解决:给对象所属的加一个serialVersionUID
技巧:打开ArrayList源码,它也实现了Serializable 接口

public class User implements Serializable {//serialVersionUID 序列号//如果我们自己没有定义,那么虚拟机会根据类中的信息会自动的计算出一个序列号.//问题:如果我们修改了类中的信息.那么虚拟机会再次计算出一个序列号.//第一步:把User对象序列化到本地. --- -5824992206458892149//第二步:修改了javabean类. 导致 --- 类中的序列号 4900133124572371851//第三步:把文件中的对象读到内存. 本地中的序列号和类中的序列号不一致了.//解决?//不让虚拟机帮我们自动计算,我们自己手动给出.而且这个值不要变.private static final long serialVersionUID = 1L;// ...其他代码省略}

4. 注意:成员不想序列化处理

给该成员变量加transient关键字修饰,该关键字标记的成员变量不参与序列化过程

public class User implements Serializable {private static final long serialVersionUID = 1L;private String username;private transient String password;}

5. 循环获取对象操作流

方式一

public static void main(String[] args) throws IOException, ClassNotFoundException {Student s1 = new Student("杜子腾",16);Student s2 = new Student("张三",23);Student s3 = new Student("李四",24);ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("a.txt"));oos.writeObject(s1);oos.writeObject(s2);oos.writeObject(s3);oos.close();ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));Object obj;// 对象操作流,不是null,也不是-1,而是一个异常错误/*  while((obj = ois.readObject()) != null){System.out.println(obj);}*/while(true){try {Object o = ois.readObject();System.out.println(o);} catch (EOFException e) {break;}}ois.close();}

方式二

public static void main(String[] args) throws IOException, ClassNotFoundException {Student s1 = new Student("杜子腾",16);Student s2 = new Student("张三",23);Student s3 = new Student("李四",24);ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("a.txt"));ArrayList<Student> list = new ArrayList<>();list.add(s1);list.add(s2);list.add(s3);//我们往本地文件中写的就是一个集合oos.writeObject(list);oos.close();ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));ArrayList<Student> list2 = (ArrayList<Student>) ois.readObject();for (Student student : list2) {System.out.println(student);}ois.close();}

19.9 Properties

1. Properties概述

  • 是一个Map体系的集合类
  • Properties中有跟IO相关的方法
  • 只存字符串

2. Properties集合的增删改查

public static void main(String[] args) {Properties prop = new Properties();//增prop.put("小龙女","尹志平");prop.put("郭襄","杨过");prop.put("黄蓉","欧阳克");System.out.println(prop);//删//prop.remove("郭襄");//System.out.println(prop);//改//put --- 如果键不存在,那么就添加,如果键存在,那么就覆盖.prop.put("小龙女","杨过");System.out.println(prop);//查//Object value = prop.get("黄蓉");//System.out.println(value);//遍历Set<Object> keys = prop.keySet();for (Object key : keys) {Object value = prop.get(key);System.out.println(key + "=" + value);}System.out.println("========================");//装的是所有的键值对对象.Set<Map.Entry<Object, Object>> entries = prop.entrySet();for (Map.Entry<Object, Object> entry : entries) {Object key = entry.getKey();Object value = entry.getValue();System.out.println(key + "=" + value);}}

3. Properties集合的特有方法

public static void main(String[] args) {//Object setProperty​(String key, String value) --- put替代//设置集合的键和值,都是String类型,底层调用 Hashtable方法 putProperties prop = new Properties();prop.setProperty("江苏","南京");prop.setProperty("安徽","南京");prop.setProperty("山东","济南");System.out.println(prop);//String getProperty​(String key)  --- get替代//使用此属性列表中指定的键搜索属性/* String value = prop.getProperty("江苏");System.out.println(value);*///Set<String> stringPropertyNames​()  --- keySet替代//从该属性列表中返回一个不可修改的键集,其中键及其对应的值是字符串Set<String> keys = prop.stringPropertyNames();for (String key : keys) {String value = prop.getProperty(key);System.out.println(key + "=" + value);}}

4. Properties集合与IO有关方法–load

public static void main(String[] args) throws IOException {//void load​(Reader reader)                     将本地文件中的键值对数据读取到集合中//void store​(Writer writer, String comments)   将集合中的数据以键值对形式保存在本地//读取Properties prop = new Properties();FileReader fr = new FileReader("prop.properties");//调用完了load方法之后,文件中的键值对数据已经在集合中了.prop.load(fr);fr.close();System.out.println(prop);}
}

5. Properties集合与IO有关方法–store

public static void main(String[] args) throws IOException {//void load​(Reader reader)                     将本地文件中的键值对数据读取到集合中//void store​(Writer writer, String comments)   将集合中的数据以键值对形式保存在本地Properties prop = new Properties();prop.put("zhangsan","123");prop.put("lisi","456");prop.put("wangwu","789");FileWriter fw = new FileWriter("prop.properties");prop.store(fw,null);fw.close();}

Java:File和IO流相关推荐

  1. 11. Java File和IO流(下)

    Java File和IO流 5. 缓冲流 5.1 概述 5.2 字节缓冲流 5.3 字符缓冲流 6. 转换流 6.1 问题引出 - 不同编码读取乱码问题 6.2 字符输入转换流 6.3 字符输出转换流 ...

  2. java(File、IO流)

    IO流 一.IO流和File类 二 .File类 绝对路径和相对路径 file的成员方法 file的创建方法 file的删除方法 file的判断和获取功能 高级获取方法listFiles() file ...

  3. Java面试知识点:File、IO流

    问题:Java面试知识点:File.IO流 答案: 1.File listFiles方法注意事项: • 当调用者不存在时,返回null • 当调用者是一个文件时,返回null • 当调用者是一个空文件 ...

  4. java中io流实现哪个接口_第55节:Java当中的IO流-时间api(下)-上

    标题图 Java当中的IO流(下)-上日期和时间日期类:java.util.Date 系统时间:long time = System.currentTimeMillis();public class  ...

  5. Java中的IO流(六)

    上一篇<Java中的IO流(五)>把流中的打印流PrintStream,PrintWriter,序列流SequenceInputStream以及结合之前所记录的知识点完成了文件的切割与文件 ...

  6. java中的IO流(超全)(超详解)结合实例轻松掌握

    java进阶之IO流 IO流的概念(大纲): 1.InputStream和OutputStream的继承关系图 2.Reader和Writer的继承关系图 3.文件专属流(加※为重点掌握) ※File ...

  7. 【Java基础】· IO流习题详解

    写在前面 Hello大家好, 我是[麟-小白],一位软件工程专业的学生,喜好计算机知识.希望大家能够一起学习进步呀!本人是一名在读大学生,专业水平有限,如发现错误或不足之处,请多多指正!谢谢大家!!! ...

  8. Java当中的IO流(中)

    Java当中的IO流(中) 删除目录 import java.io.File;public class Demo{public static void main(String[] args){// 目 ...

  9. Java当中的IO流-时间api(下)-上

    Java当中的IO流(下)-上 日期和时间 日期类:java.util.Date 系统时间: long time = System.currentTimeMillis(); public class ...

  10. Java基础学习—— IO流

    Java基础学习-- IO流 1 文件 1.1 文件的创建 1.2 文件常用的方法 2 IO流 2.1 FileInputStream 2.2 FileOutputStream 2.3 文件的拷贝 2 ...

最新文章

  1. mysql分页 redis_分页查询和redis
  2. 一个关于在Fedora下安装jdk的问题
  3. qpython手机版-QPython,一个在手机上运行Python的神器
  4. MetadataType的使用
  5. python解析.pyd文件
  6. 防止按钮连续重复点击
  7. java将csv导入hdfs_把HDFS里的json数据转换成csv格式
  8. 2017-2018-1 JAVA实验站 第四、五周作业
  9. Adobe 字体显示不清楚----解决方案
  10. 公众号申请并发布文章教程
  11. 计算机视觉研究新方向:自监督表示学习总结(建议收藏)
  12. 农信社计算机类试卷,农信社真题:开封农村信用社计算机考试试题合集
  13. 区块链-拜占庭将军问题介绍
  14. 京东手机销售数据分析,华为和三星的距离还有多远?
  15. MFC系列 - 第一个MFC入门程序
  16. 马斯洛需求层次与产品的关系
  17. 路由器连接校园网并发WIFI:WR703N路由器安装OpenWRT并运行H3C客户端操作步骤(主要针对中山大学东校区)
  18. 从一个实例中学习DTW算法
  19. VRT系统常用命令总结
  20. Mysql(一)LIKE通配符

热门文章

  1. oracle导出辅助账明细,AO2011导入国库集中支付系统3.0的辅助账资料.doc
  2. pla3d打印材料密度_3D打印材料:PLA (聚乳酸)材料
  3. Unraid 使用技巧集合
  4. 脉冲宽度调制(SPWM)Simulink仿真教程
  5. 微信公众平台开发(100) 2048游戏
  6. 计算机内存占用过高怎么办,电脑内存占用过高怎么办?
  7. Qt蓝牙:QBluetoothDeviceInfo、QBluetoothAddress
  8. 什么是企业架构师?关于这个角色,你需要知道的一切及其未来发展
  9. 思科 计算机网络 第十章测试考试答案
  10. 以STM32F103RCT6为例分析单片机的RAM以及ROM使用情况