克拉玛依市政府网,月殇小说,权力的游戏第一季下载
默认使用的就是gbk编码,这里的例子改成了utf8编码
写入—编码
private static void writeText() throws IOException { FileOutputStream fos = new FileOutputStream("utf8.txt"); OutputStreamWriter osw = new OutputStreamWriter(fos,"UTF-8"); osw.write("求"); osw.close(); }
读取—解码
private static void readCNText() throws IOException { FileInputStream fis = new FileInputStream("utf8.txt"); InputStreamReader isr = new InputStreamReader(fis,"UTF-8"); int i = 0; while((i = isr.read())!=-1){ System.out.println((char)i); } isr.close(); }
字符流 = 字节流 + 编码表
#####################快捷操作的类
FileWriter and FileReader
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论