What are I / O Streams in Java

General relationship diagram for I / O stream classes

Byte Stream: Used to process byte data. The byte stream can be used to copy all data, read and write files. However, reading Byte Stream Chinese can result in garbled characters.

Character stream: Reading Chinese in the character stream does not cause garbled characters. The character stream can be used to copy (read and write files) data in plain text. Non-plaintext cannot be copied from the character stream, only from the byte stream

Usage examples for common streams

  • General method of copying and pasting plain text

  • Efficient way to copy and paste plain text

  • Byte (universal) method of copying and pasting

  • Efficient (universal) byte copy and paste method

  • Conversion Stream (can avoid the garbled problem that occurs when reading files with different encodings and writing them inside each other (GBK-two bytes per character, UTF-8-three bytes per character) because the stream has a special method of construction that does this can be specified encoding type of the stream)