Reader/Writer与InputStream/OutputStream的区别
来源:互联网 发布:方正兰亭超细黑 mac 编辑:程序博客网 时间:2024/04/30 18:04
1. Readers and writers are like input streams and output streams. The primary difference lies in the
fundamental datatype that is read or written; streams are byte-oriented, whereas readers and
writers use characters and strings.
2. The reason for this is internationalization. Readers and writers were designed to allow programs
to use a localized character set and still have a stream-like model for communicating with
external devices.
3. These are analogous to the read( ) methods defined for InputStream. For example, read( )
still returns an integer. The difference is that, instead of data values being in the range of 0-255
(i.e., single bytes), the return value is in the range of 0-65535 (appropriate for characters, which
are 2 bytes wide).
4. Instead, readers and writers can be used as a layer on top of streams™ most readers have a
constructor that takes an InputStream as an argument, and most writers have a constructor
that takes an OutputStream as an argument.
FileOutputStream destination = new FileOutputStream(fileName);
BufferedOutputStream bufferedDestination = new BufferedOutputStream(destination);
GZIPOutputStream zippedDestination = new GZIPOutputStream(bufferedDestination);
OutputStreamWriter destinationWriter = new OutputStreamWriter(zippedDestination);
- Reader/Writer与InputStream/OutputStream的区别
- InputStream、OutputStream、Reader和Writer的关系
- Java InputStream和OutputStream,Reader和Writer的辨析
- InputStream & OutputStream V.S. Reader & Writer
- java中的InputStream、OutputStream以及Reader、Writer
- OutputStream、InputStream、Writer、Reader学习笔记
- 输入输出之InputStream&OutputStream、Reader&Writer
- java OutputStream和InputStream Writer和Reader
- InputStream和Reader、 OutputStream和Writer
- OutputStream和InputStream,Writer和reader
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- 字节流与字符流简单操作(OutputStream、InputStream、Writer、Reader)
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- Java IO--字节流与字符流OutputStream/InputStream/Writer/Reader
- InputStream与Reader的区别
- InputStream 与Reader的区别
- Java 输出流转输入流的方法(OutputStream转InputStream,Writer转Reader)
- Java IO 文件流的读,文件流写Writer,Reader,InputStream,OutputStream封装
- thinkphp 简单分页
- 14岁初中生—— 踏踏实实的人生也最美
- 谷歌创始人布林:行事低调神秘却威力四射
- 深入理解C++中的mutable关键字
- Win8 Metro风格应用中梯形动画的一种实现方法(C# & XAML)
- Reader/Writer与InputStream/OutputStream的区别
- winhex操作——保存修改后的数据
- Jsp中application session request的区别实例
- SL项目 web.g.s 实体从 ComplexObject 继承改为从Entity 继承了
- 在ubuntu下安装xinetd模式的tftpd服务
- c++ 函数返回引用
- {{JS}}深入理解this关键字
- 演练:使用 SQL Server CE 数据库
- C语言指针5分钟教程