package J20250728;

import java.io.*;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo01_InputStreamReader
 * @description 转换流
 * @create 2025/7/28
 */
public class Demo01_InputStreamReader {
    public static void main(String[] args) throws IOException {
        //基础流---文件字节输入流
        FileInputStream fis=new FileInputStream("D:/排序.txt");
        //处理流---转换流(字节->字符)
        InputStreamReader isr=new InputStreamReader(fis, "UTF-8");
        //基础流---文件字节输出流
        FileOutputStream fos=new FileOutputStream("D:/排序001.txt");
        //处理流---转换流(字符->字节)
        OutputStreamWriter osw=new OutputStreamWriter(fos,"GBK");
        int c;
        while ((c=isr.read())!=-1){
            System.out.println(c);
            osw.write(c);
        }
        isr.close();
        osw.close();
        fis.close();
        fos.close();
    }
}
