In this example we are going to convert Inputstream to Bufferedreader.
The class java.io.InputStream is an abstract class which extends Object class. java.io.InputStream is superclass of all classes that represents an input stream of byte.
In this example we are creating an object of InputStreamReader that reads data from InputData (i.e. System.in) class. This data is in the form of bytes. To convert the byte form data into character form we hava to wrap it into InputStreamReader and finally we convert the InputStream into BufferedReader .
The code of the program is given below:
The output of the program is given below:
C:\rajesh>java InputstramToBufferreaderExample Enter the input stream: rajesh kumar The values after BufferedReader:rajesh kumar
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 19, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles