How To Read A File In Java Using BufferReader Java Interview Question And Answer

Publicado el: 30 noviembre 2013
en el canal de: Interview DOT
1,167
5

Click here -    / @interviewdot   to get notifications. How to read a file in Java -- BufferReader ? Java Interview Question And Answer

The BufferedReader class provides buffering to your Reader's. Buffering can speed up IO quite a bit. Rather than read one character at a time from the network or disk, you read a larger block at a time. This is typically much faster, especially for disk access and larger data amounts.

The main difference between BufferedReader and BufferedInputStream is that Reader's work on characters (text), wheres InputStream's works on raw bytes.

A BufferedReader is a "high-level" reader, i.e it can't connect directly to a file or input stream.

It is used to make more efficient use of low-level readers because they only read in bytes and chars whereas a BufferedReader can read Strings with the readLine() method.

br.readLine()  a method used to read characters from input stream and put them in the string in one go not byte by byte.

BufferedReader is synchronized, so read operations on a BufferedReader can safely be done from multiple threads.


En esta página del sitio puede ver el video en línea How To Read A File In Java Using BufferReader Java Interview Question And Answer de Duración hora minuto segunda en buena calidad , que subió el usuario Interview DOT 30 noviembre 2013, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,167 veces y le gustó 5 a los espectadores. Disfruta viendo!