Reader/Writer與InputStream/OutputStream的區別

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.
app

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.
ide

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.
this

1.主要區別在於被讀和被寫入的基本數據類型;InputStream OutputStream 是面向字節的,Reader Writer 使用的字符和字符串。

2.國際化:Reader Writer容許的程序使用本地化的字符集,仍然有流的特性。

3.Reader定義上相似InputStream的。例如,Reader仍是返回一個整數。所不一樣的是,代替數據值在0-255的範圍內(即單字節),返回值是在0-65535之間(適合字符,2個字節寬)。

4.大多數Reader 有一個構造函數的InputStream做爲參數,而且大多數Writer 有一個構造函數這須要一個OutputStream做爲參數。
spa

相關文章
相關標籤/搜索