IO

 1.处理流是在节点流的基础之上,通过对数据的处理为程序提供更强大的读写功能;例如:将字节转换为String型进行输出。

2.p2p损硬盘原因是频繁读取写入信息;通过缓冲解决。int read(byte[] buffer)throws IOException

write-flush-close

3.FileWriter fw = new FileWriter ("路径");

FileReader fr = new FileReader ("路径");

FileInputStream  in= new FileInputStream ("路径");

FileOutputStream  out= new FileOutputStream  ("路径");

文件复制:

 

4.缓冲流(处理流的一种):FileInputStream  in= new FileInputStream ("路径");

BufferedInputStream bis = new BufferedInputStream (in);

5.转换流(同上):InputStreamreader ;

OutputStreamWriter osw = new OutputStreamWriter(
 new FileOutputStream("d://bak//char.txt", true),"ISO8859_1");

ture表示不替代;"ISO8859_1"==latin-1;

6.数据流:ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
DataOutputStream dos =  new DataOutputStream(baos);

dos.writeDouble(Math.random());

7.Print 流:FileOutputStream fos = new FileOutputStream("d://bak//log.dat");
ps = new PrintStream(fos);System.setOut(ps);

8.Object流:序列化:将Object流转换为字节流直接写到网络上或硬盘上。

class T  implements Serializable 必须实现**接口

transient 声明的变量序列化时不予考虑。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值