随笔分类 - IO字符流。
摘要:public class Test3{ public static void main(String[] args){ 1.创建带缓冲的输入流对象 BufferedReader br = new BufferedReader (new FileReader("zzz.txt")); 2.创建双列集合
阅读全文
摘要:public class Demo_TransIO{ public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException,IOException{ InputStreamR
阅读全文
摘要:装饰设计模式优点:耦合性不强,被装饰的类的变化与装饰类的变化无关 public static void main (String[] args){ HeiMaStudent hms = new HeiMaStudent (new Student()); hms.code(); } interface
阅读全文
摘要:public class Demo5_LineNumberReader{ public static void main(String[] args) throws IOException{ LineNumberReader lnr = new LineNumberReader(new FileRe
阅读全文
摘要:public class Test1(){ 将一个文本文档上的文本反转,第一行和倒数第一行交换,第二行和倒数第二行交换。 分析:1.创建输入输出流对象 2.创建集合对象 3.将读到的数据存储在集合中 4.倒着遍历集合将数据写到文件上 5.关流。 注意事项:流对象应该尽量晚开早关。 public st
阅读全文
摘要:public class Demo4_Buffered(){ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader (new FileRead("xxx.tx
阅读全文
摘要:public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader (new FileReader("xxx.txt")); BufferedWriter bw = new
阅读全文
摘要:public static void main(String[] args) throws IOException{ FileRead fr = new FileRead ("xxx.txt"); FileWrite fw = new FileWrite ("yyy.txt"); char [] a
阅读全文
摘要:public static void main(String[] args) throws IOException{ FileReader fr = new FileReader("xxx.txt"); FileWrite fw new FileWrite ("zzz.txt"); int c; w
阅读全文

浙公网安备 33010602011771号