字节流转字符流
来源:互联网 发布:windows软件功能 编辑:程序博客网 时间:2024/04/29 22:12
package test;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.Reader;import java.io.Writer;public class Test { public static void main(String[] args) throws IOException { outputStreamToWriter(); inputStreamToReader(); } public static void outputStreamToWriter() throws IOException{ File f=new File("d:"+File.separator+"text.txt"); Writer writer=new OutputStreamWriter(new FileOutputStream(f)); writer.write("Hello World!"); writer.close(); } /**输入: 字节流转字符流 * @throws IOException **/ public static void inputStreamToReader() throws IOException{ File f=new File("d:"+File.separator+"text.txt"); Reader reader=new InputStreamReader(new FileInputStream(f)); char c[]=new char[1024]; int len=reader.read(c); reader.close(); System.out.println(new String(c,0,len)); } /** * 输出Hello World! */}
0 0
- 字节流转字符流
- 字节流转字符流
- 字节流转换字符流
- 字节流转换成字符流
- java 字节流转字符流
- 字节流转换字符流
- 字节流转换字符流
- 流转换成字符,流转换成字节流。stream2String,stream2Bytes
- 字符流转换为字节流
- 字节流与字符流转换操作
- 字节流转换字符流实例
- 字节流转换字符流实例
- 字节流转换为字符流
- 字节流转换为字符流
- Java 字节流、字符流转换
- 字节流与字符流转换
- Java字符流与字节流转换
- 字节流转化为字符流输出
- 游戏中MyBatis的动态SQL语句写法
- ./cts-tradefed run error[REASON:java config is not right]
- Swift之?和!
- 编辑XML
- 【MAC使用技巧】打不开xxx.pkg,因为它来自身份不明的开发者
- 字节流转字符流
- OC基础:Date
- Mac键盘图标与对应快捷按键标志汇总
- linux中gdb的使用方法
- 打算打造一个最牛iOS培训品牌
- wp8将List对象转Json字符串用于网络传输
- MySQL存储过程
- zendstudio 汉化方法
- cobbler安装