What is the relation between InputStream, BuffreredInputStream, InputStreamReader and BufferedReader? [closed]

雨燕双飞 提交于 2019-12-13 09:53:32

问题


I always get confused when to process my input data how, which process. Different times i find different solutions. I am also not clear about their Hierarchy.


回答1:




InputStream is parent class of all input streams and readers. Classes that have Stream keyword will work with bytes whereas classes which have Reader keyword will work with characters.

Buffer is wrapper around these streams to decrease the system calls and increase performance and speed of reading.

Non buffered streams return single byte each time whereas Bufferd stream will not return until the buffer gets full.

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



来源:https://stackoverflow.com/questions/32175221/what-is-the-relation-between-inputstream-buffreredinputstream-inputstreamreade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!