Java 流的分類

package hello.IO;

import java.io.*;

public class IO {
    static void test1() throws IOException {
        //文件字節輸出流
        FileOutputStream out = new FileOutputStream("src//tep.txt");
        String str = "";
        byte[] buffer = str.getBytes();
        out.write(buffer);
        out.close();
        //文件字節輸入流
        FileInputStream in = new FileInputStream("");
        int a;
        while ((a = in.read()) != -1) {
            System.out.print(a);
        }
        in.close();
        //文件字符輸出流
        FileWriter o = new FileWriter("");
        str = "我在";
        o.write(str);
        o.close();
        //文件字符輸入流
        FileReader r = new FileReader("");
        
    }

    public static void main(String[] args) {

    }

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章