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

Pubblicato il: 30 novembre 2013
sul canale di: 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.


In questa pagina del sito puoi guardare il video online How To Read A File In Java Using BufferReader Java Interview Question And Answer della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Interview DOT 30 novembre 2013, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,167 volte e gli è piaciuto 5 spettatori. Buona visione!