随笔分类 -  IO

摘要:从上篇文章中知道BufferedInputStream是自带缓冲区的输入流,可以大大减少IO次数,提供效率。下面的例子中实现了用BufferedInputStream与FileInputStream实现20M文件的差异public class BufferedOutputStreamDemo { /... 阅读全文
posted @ 2014-08-27 10:04 marco_tan 阅读(760) 评论(0) 推荐(0)
摘要:BufferedInputStream是一个带有缓冲区域的InputStream,它的继承体系如下:InputStream|__FilterInputStream |__BufferedInputStream首先了解一下FilterInputStream:FilterInputStream通过装饰器... 阅读全文
posted @ 2014-08-27 09:53 marco_tan 阅读(1131) 评论(1) 推荐(0)
摘要:Java 流在处理上分为字符流和字节流。字符流处理的单元为 2 个字节的Unicode字符,分别操作字符、字符数组或字符串,而字节流处理单元为 1 个字节,操作字节和字节数组。Java 内用 Unicode 编码存储字符,字符流处理类负责将外部的其他编码的字符流和java内 Unicode 字符流之... 阅读全文
posted @ 2014-08-26 21:01 marco_tan 阅读(180) 评论(0) 推荐(0)
摘要:【案例1】创建一个新文件1234567891011importjava.io.*;classhello{publicstaticvoidmain(String[] args) {File f=newFile("D:\\hello.txt");try{f.createNewFile();}catch(... 阅读全文
posted @ 2014-08-26 09:10 marco_tan 阅读(319) 评论(0) 推荐(0)