What is the difference between Bufferreader and InputstreamReader in Java? tccicomputercoaching.com BufferedReader and InputStreamReader are both Input Function in Java File. BufferedReader reads a couple of characters from the specified stream and stores it in a buffer. This makes input faster. InputStreamReader reads only one character from specified stream and remaining characters still remain in the stream.
Example: 1. 2. 3.
class NewClass { public static void main(String args[]) throws InterruptedException, IOException 4. { 5. BufferedReader isr = new BufferedReader(new InputStreamReader(System.in)); 6. Scanner sc = new Scanner(System.in); 7. System.out.println("B.R. - "+(char)isr.read()); 8. System.out.println("Scanner - " + sc.nextLine()); 9. } 10. }