103103 public boolean delete() :删除文件或者文件夹
104104 ```
105105
106- <font color =' #EE0000 ' >删除注意事项</font >:Java 中的删除不走回收站。
106+ <font color =' #EE0000 ' >删除注意事项</font >:Java 中的删除不走回收站。
107107
108108### 4.内存解析
109109
@@ -261,22 +261,22 @@ public void close throws IOException{}
261261 ``` java
262262 void write(int c)
263263 写入单个字符。要写入的字符包含在给定整数值的16 个低位中,16 高位被忽略。即写入0 到65535 之间的 Unicode 码。
264-
264+
265265 void write(char [] cbuf)
266266 写入字符数组
267-
267+
268268 void write(char [] cbuf,int off,int len)
269269 写入字符数组的某一部分。从off开始,写入len个字符
270-
270+
271271 void write(String str)
272272 写入字符串。
273-
273+
274274 void write(String str,int off,int len)
275275 写入字符串的某一部分。
276-
276+
277277 void flush()
278278 刷新该流的缓冲,则立即将它们写入预期目标。
279-
279+
280280 public void close throws IOException {}
281281 关闭此输出流并释放与该流关联的所有系统资源
282282 ```
@@ -322,9 +322,9 @@ public void close throws IOException{}
322322 FileReader fr = null ;
323323 try {
324324 File file = new File (" hello.txt" );
325-
325+
326326 fr = new FileReader (file);
327-
327+
328328 // 每一次返回charBuffer数组中字符的个数, 如果达到文件末尾, 返回-1
329329 char [] charBuffer = new char [5 ];
330330 int len;
@@ -372,16 +372,16 @@ public void close throws IOException{}
372372 public void testFileWriter() throws IOException {
373373 // 1. 提供File类的对象, 指名写出到的文件
374374 File file = new File (" FileWriterTest.txt" );
375-
375+
376376 // 2. 提供FileWriter的对象, 用于数据的写出
377377 FileWriter fw = new FileWriter (file);
378378 FileWriter fw = new FileWriter (file,(append: ) false );
379379 // append default false, 意为覆盖文件
380380 // append为true, 则是在文件后面添加
381-
381+
382382 fw. write(" Hello\n " );
383383 fw. write(" world" );
384-
384+
385385 fw. close();
386386 }
387387 ```
@@ -511,7 +511,7 @@ public void close throws IOException{}
511511 new File (" Chap19_IOStream\\ testFile\\ copyTest_src.txt" )));
512512 bw = new BufferedWriter (new FileWriter (
513513 new File (" Chap19_IOStream\\ testFile\\ copyTest_des2.txt" )));
514-
514+
515515 // 复制方式一 使用char数组
516516 char [] buffer = new char [10 ];
517517 int len;
@@ -523,7 +523,7 @@ public void close throws IOException{}
523523 while ((data = br. readLine()) != null ) {
524524 bw. write(data);
525525 }
526-
526+
527527 } catch (IOException e) {
528528 throw new RuntimeException (e);
529529 } finally {
@@ -630,11 +630,11 @@ public void test() {
630630
631631 - ` ASCII ` :美国标准信息交换码。
632632
633- 用一个字节的 7 位可以表示。
633+ 用一个字节的 7 位可以表示。
634634
635635 - ` ISO8859-1 ` :拉丁码表。
636636
637- 欧洲码表用一个字节的 8 位表示。
637+ 欧洲码表用一个字节的 8 位表示。
638638
639639 - ` GB2312 ` :中国的中文编码表。==最多==两个字节编码所有字符
640640
@@ -700,11 +700,11 @@ public void test() {
700700
701701 ` System.in ` :标准的输入流,默认从键盘输入
702702
703- ` public final static InputStream in = null; ` , 为 InputStream
703+ ` public final static InputStream in = null; ` , 为 InputStream
704704
705705 ` System.out ` :标准的输出流,默认从控制台输出
706706
707- ` public final static PrintStream out = null; ` , 为[ PrintStream] (# 七、打印流<了解>)
707+ ` public final static PrintStream out = null; ` , 为[ PrintStream] (# 七、打印流<了解>)
708708
7097092 . 主要方法
710710
@@ -823,16 +823,16 @@ public void test() {
823823
824824 }
825825 }
826- ```
826+ ```
827827
828828# 八、 数据流<了解>
829829
8308301 . 作用:用于==读取==或==写出==基本数据类型的变量/字符串
831831
832832 - FileWrite 的 write 只能输出字符串 / 字符数组
833833
834- | <img src =" media/FileWrite的write方法重载.png " alt =" FileWrite的write方法重载 " style =" zoom : 50% ;" /> | <img src =" C:\Users\14258\AppData\Roaming\Typora\typora-user-images\ image-20220729153009487.png" alt =" image-20220729153009487 " style =" zoom :50% ;" /> |
835- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- ------------------------------------------------------------ |
834+ | <img src =" media/FileWrite的write方法重载.png " alt =" FileWrite的write方法重载 " style =" zoom : 50% ;" /> | <img src =" media/ image-20220729153009487.png" alt =" image-20220729153009487 " style =" zoom :50% ;" /> |
835+ | ------------------------------------------------------------ | ------------------------------------------------------------ |
836836
837837 - FileOutput 的 write 只能输出字节
838838
@@ -878,11 +878,11 @@ public void test() {
878878
8798792. ** 序列化的好处** :
880880
881- 可将任何实现了 Serializable 接口的对象转化为== 字节数据== ,使其在保存和传输时可被还原。
881+ 可将任何实现了 Serializable 接口的对象转化为== 字节数据== ,使其在保存和传输时可被还原。
882882
8838833. ** 序列化的重要性** :
884884
885- 序列化是 RMI (Remote Method Invoke - 远程方法调用) 过的参数和返回值都必须实现的机制,RMI 是 JavaEE 的基础。因此序列化机制是 JavaEE 平台的基础。
885+ 序列化是 RMI (Remote Method Invoke - 远程方法调用) 过的参数和返回值都必须实现的机制,RMI 是 JavaEE 的基础。因此序列化机制是 JavaEE 平台的基础。
886886
8878874. ** 如何实现序列化机制** :
888888
@@ -961,17 +961,17 @@ public void test() {
961961 ObjectInputStream ois = null ;
962962 try {
963963 ois = new ObjectInputStream (new FileInputStream (" object.dat" ));
964-
964+
965965 Object obj = ois. readObject();
966966 String str = (String ) obj;
967-
967+
968968 Person p = (Person ) ois. readObject();
969969 Person p1 = (Person ) ois. readObject();
970-
970+
971971 System . out. println(str);
972972 System . out. println(p);
973973 System . out. println(p1);
974-
974+
975975 } catch (IOException e) {
976976 e. printStackTrace();
977977 } catch (ClassNotFoundException e) {
@@ -986,7 +986,7 @@ public void test() {
986986 }
987987 }
988988 }
989-
989+
990990 ```
991991
992992# 十、 任意存取文件流
0 commit comments