What is the relationship between InputStream, BuffreredInputStream, InputStreamReader and BufferedReader?

I am always embarrassed when I process my input as which process. At different times, I find different solutions. I also do not quite understand their Hierarchy.

-3
source share
1 answer

enter image description here

An InputStream is the parent class of all input streams and readers. Classes with the Stream keyword will work with bytes, while classes with the Reader keyword will work with characters.

A buffer is a wrapper around these threads to reduce system calls and improve performance and read speed.

Non-buffered streams return one byte each time, while a Bufferd stream does not return until the buffer is full.

For example, if you take a BufferedReader, you can read the whole line using readLine(), but in non buffered stream, you must read a single character using the method read().

+1
source

Source: https://habr.com/ru/post/1673737/


All Articles