整理Java IO流的关系,并作图如下,以供参考。
下图基于JDK 1.8制作,其中需要注意的是StringBufferInputStream和LineNumberInputStream已被废弃。
详情如下:
1. StringBufferInputStream
@deprecated
This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the <code>StringReader</code> class.
由于该类无法准确的将字符转换为字节,因此建议用StringReader来取代使用。
2. LineNumberInputStream
@deprecated
This class incorrectly assumes that bytes adequately represent * characters. As of JDK 1.1, the preferred way to operate on * character streams is via the new character-stream classes, which * include a class for counting line numbers.
由于该类错误地认为字节能恰当地表示字符,因此推荐使用字符流的类来取代,即LineNumberReader。