Byte Stream and Character stream

前端 未结 5 858
我在风中等你
我在风中等你 2020-11-29 18:27

Please explain what Byte streams and Character streams are. What exactly do these mean? Is a Microsoft Word document Byte oriented or Character oriented?

Thanks

5条回答
  •  没有蜡笔的小新
    2020-11-29 19:30

    A character stream will read a file character by character. The character streams are capable to read 16-bit characters (byte streams read 8-bit characters). Character streams are capable to translate implicitly 8-bit data to 16-bit data or vice versa. Character stream can support all types of character sets ASCII, Unicode, UTF-8, UTF-16 etc.But byte stream is suitable only for ASCII character set.The Java platform stores character values using Unicode conventions. Character stream I/O automatically translates this internal format to and from the local character set.

    Unless you are working with binary data, such as image and sound files, you should use readers and writers to read and write information with character streams.

提交回复
热议问题