answersLogoWhite

0

InputReader can covert bytes in different encodings to characters.

BufferedReader has a back-end reader which speeds up reading if you are only retrieving small parts at a time.

BufferedReader can mark a given position, and after already reading the bytes, reset back to the previous position.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

What is meaning for BufferedReader br equals new BufferedReader new InputStreamReade System in?

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));This line will create a new BufferedReader object, which reads from System.in (standard input). The InputStreamReader part is used to convert System.in (which is an InputStream) to a Reader object (which can be used by BufferedReader).After creating br, you can read input from the user:String input = br.readLine();The line above will allow the user to type in anything they want, press the button, and have what they typed in stored in input.


What is the use of BufferedReader in Java programming?

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. To add buffering to your Reader's simply wrap them in a BufferedReader. Here is how that looks: Reader input = new BufferedReader( new FileReader("c:\\data\\input-file.txt"));


How do you write a program that takes a list of all positive integers from input and counts as the integers are input?

// create an BufferedReader from the standard input stream BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String currentLine = ""; int total = 0; // read integers System.out.print("Input an integer: "); while (!(currentLine = in.readLine()).equals("")) { int input = 0; try { input = Integer.valueOf(currentLine); total += input; } catch (final NumberFormatException ex) { System.out.println("That was not an integer."); } System.out.print("Input an integer: "); }


How do you find odd numbers between two numbers in java?

import java.io.*; class aeven { public static void main(String[] args) { try{ BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter 1st number : "); int num1 = Integer.parseInt(br1.readLine()); System.out.println("Enter 2nd number : "); int num2 = Integer.parseInt(br1.readLine()); System.out.println("Odd Numbers : "); for (int i=num1;i <=num2 ; i++) { if(i%2!=0 ) { System.out.print(i+ ", "); } } } catch(Exception e){} } }


Write a java application to accept a string display in following formet NOT to TON?

import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;class format{public static void main(String args[])throws IOException{BufferedReader y=new BufferedReader(new InputStreamReader(System.in));System.out.println("Enter word");String w=y.readLine();for (int a=w.length()-1;a>=0;a--){char c=w.charAt(a);System.out.print(c);}}}

Related Questions

What is meaning for BufferedReader in equals new BufferedReader new InputStreamReade System in?

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));This line will create a new BufferedReader object, which reads from System.in (standard input). The InputStreamReader part is used to convert System.in (which is an InputStream) to a Reader object (which can be used by BufferedReader).After creating br, you can read input from the user:String input = br.readLine();The line above will allow the user to type in anything they want, press the button, and have what they typed in stored in input.


How do you input and display a character in java?

to input a character follow this code: InputStreamReader is=new InputStreamReader(System.in); BufferedReader bf=new BufferedReader(is); ch=bf.readLine(); //to display a character simply write System.out.println() i hope dis vl help u


What is meaning for BufferedReader br equals new BufferedReader new InputStreamReade System in?

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));This line will create a new BufferedReader object, which reads from System.in (standard input). The InputStreamReader part is used to convert System.in (which is an InputStream) to a Reader object (which can be used by BufferedReader).After creating br, you can read input from the user:String input = br.readLine();The line above will allow the user to type in anything they want, press the button, and have what they typed in stored in input.


What difference between InputStreamReader and DatainputStream in java?

Both are same


Example of BufferedReader mothod in java programming?

import java.io.*; class gar { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter a value: "); int a=Integer.parseInt(in.readLine()); } }


Write a program in java to start mysql service in windows.?

String startCommandScript[] = { "cmd.exe", "/c", "sc", "Start", "MySQL" }; Process process; try { process = new ProcessBuilder(commandScript).start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; //System.out.printf("Output of running cmd /c dir is:"); while ((line = br.readLine()) != null) { // if (line.matches("controlservice failed")) { // System.out.println("......."); // } // System.out.println(line); } br.close(); isr.close(); is.close(); process.destroy(); } catch (IOException e) { e.printStackTrace(); }


What is the use of BufferedReader in Java programming?

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. To add buffering to your Reader's simply wrap them in a BufferedReader. Here is how that looks: Reader input = new BufferedReader( new FileReader("c:\\data\\input-file.txt"));


A program using one-dimensional array that determines the lowest value among the five inputs values typed from the keyboard and prints the difference of each value from the lowest?

import java.io.*; class sing { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); int a[]=new int[5]; for(byte i=0;i<5;i++) { System.out.print("Enter the value of "+i+" : "); a[i]=Integer.parseInt(in.readLine()); } byte b=0; for(byte i=0;i<5;i++) { if(b>a[i]) b=a[i]; } }}


How do you write a program that takes a list of all positive integers from input and counts as the integers are input?

// create an BufferedReader from the standard input stream BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String currentLine = ""; int total = 0; // read integers System.out.print("Input an integer: "); while (!(currentLine = in.readLine()).equals("")) { int input = 0; try { input = Integer.valueOf(currentLine); total += input; } catch (final NumberFormatException ex) { System.out.println("That was not an integer."); } System.out.print("Input an integer: "); }


How do you find odd numbers between two numbers in java?

import java.io.*; class aeven { public static void main(String[] args) { try{ BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter 1st number : "); int num1 = Integer.parseInt(br1.readLine()); System.out.println("Enter 2nd number : "); int num2 = Integer.parseInt(br1.readLine()); System.out.println("Odd Numbers : "); for (int i=num1;i <=num2 ; i++) { if(i%2!=0 ) { System.out.print(i+ ", "); } } } catch(Exception e){} } }


What is the difference between datainputstream and bufferedreader?

The differences are: The DataInputStream works with the binary data, while the BufferedReader work with character data. All primitive data types can be handled by using the corresponding methods in DataInputStream class, while only string data can be read from BufferedReader class and they need to be parsed into the respective primitives. DataInputStream is a part of filtered streams, while BufferedReader is not. DataInputStream consumes less amount of memory space being it is binary stream, where as BufferedReader consumes more memory space being it is character stream. The data to be handled is limited in DataInputStream, where as the number of characters to be handled has wide scope in BufferedReader.


Write a program to print all the prime numbers between n and m in java?

import java.io.*; public class pmn { public static void main(String[] args) throws Exception{ int i; BufferedReader bf = new BufferedReader( new InputStreamReader(System.in)); System.out.println("Enter number:"); int num = Integer.parseInt(bf.readLine()); System.out.println("Prime number: "); for (i=1; i < num; i++ ){ int j; for (j=2; j<i; j++){ int n = i%j; if (n==0){ break; } } if(i == j){ System.out.print(" "+i); } } } }