zoukankan      html  css  js  c++  java
  • OutputStreamWriter写的转化流

    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStreamWriter;
    
    public class Demo03OutputStreamWriter {
        public static void main(String[] args) throws IOException {
    
            write_utf_8();
            write_GBK();
    
        }
    
        private static void write_GBK() throws IOException {
            OutputStreamWriter osw=new OutputStreamWriter(new FileOutputStream("F:\basic\untitled13\src\it\cast\day15\demo05\gbk.txt"),"GBK");
            osw.write("你好gbk");
            osw.flush();
            osw.close();
        }
    
        private static void write_utf_8() throws IOException {//utf-8格式的文件
            OutputStreamWriter osw=new OutputStreamWriter(new FileOutputStream("F:\basic\untitled13\src\it\cast\day15\demo05\utf_8.txt"),"UTF-8");
            osw.write("你好utf-8");
            osw.flush();
            osw.close();
        }
    }
  • 相关阅读:
    MySQL
    权限(二)
    权限(一)
    化栈为队
    栈的最小值
    实现简易版react中createElement和render方法
    12.整数转罗马数字
    call,apply,bind的理解
    8. 字符串转换整数 (atoi)
    172.阶乘后的0
  • 原文地址:https://www.cnblogs.com/cy2268540857/p/13799328.html
Copyright © 2011-2022 走看看