bufferReader and InputStreamReader

Ads

 
 
 

Share on Google+Share on Google+

sharik mushtaq khanday
bufferReader and InputStreamReader
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

bufferReader and InputStreamReader are used for what purpose?

Ads
View Answers

March 11, 2011 at 4:37 PM


BufferedReader

BufferedReader read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.

import  java.io.*;
class BufferedReaderExample{
    public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new FileReader("C:/Hello.txt"));
    String line="";
    while((line = in.readLine()) != null){
    System.out.println(line);
    }
    }
}

InputStreamReader:

InputStreamReader reads bytes and decodes them into characters using a specified charset.

import java.io.*;    
public class InputStreamReaderExample {
    public static void main(String args[]) throws Exception {
        File file = new File("C:/Hello.txt");
        InputStreamReader reader = new InputStreamReader(new FileInputStream(file));
        int data = reader.read();
        while(data != -1){
        char theChar = (char) data;
        System.out.print(theChar);
        data = reader.read();
        }
    }
}

Ads









Related Tutorials/Questions & Answers:
bufferReader and InputStreamReader
bufferReader and InputStreamReader   bufferReader and InputStreamReader are used for what purpose
Java IO InputStreamReader
Java IO InputStreamReader In this section we will discuss about the InputStreamReader in Java. java.io.InputStreamReader class takes input as a byte... a specified charset. InputStreamReader acts as a bridge between the byte reading
Advertisements
BufferReader Example
Code: import java.io.*; class BufferedRead { public static void main(String args[]) throws IOException { char c; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("\nEnter character
BufferReader example in Java
BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line
Factorial Program in Java
execution of the program. BufferReader is defined under the Java I/O package.... InputStreamReader reads the input from user and then keep it into a buffer. As Java reads... = new BufferedReader( new InputStreamReader(System.in
Java char to string
is using Scanner class. In this section we have also used BufferReader to convert... Character value is M String value is M In BufferReader example, we have... reads the input from system/user at the run time. BufferReader then reads
How to Read file line by line in Java program
a Reader like FileReader or InputStreamReader. The Reader buffers the input from.... Example of Read file line by line using BufferReader: package ReadFile; import...); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream
Java read text file
InputStreamReader(in)); String strLine; //Read File Line By Line while
Calculator program in Java
time. InputStreamReader reads the input from System.in and then keep... BufferedReader(new InputStreamReader( System.in)); double x, y, store = 0
Some error find whats the problem
Replace { public void main()throwsIoException { InputStreamReader = new InputStreamReader(System.in); BufferReader br=new BufferReader(z); System.out.println... { InputStreamReader z= new InputStreamReader(System.in); BufferedReader
Check even or odd number.
InputStreamReader(System.in)); String data = br.readLine(); num..."); } } } Description: num is variable which hold the inputted number. BufferReader
Calculate factorial of a number.
BufferedReader(new InputStreamReader(System.in)); String data = (String...)(n-3)?.1. BufferReader () is used for user input.BufferReader
java program
java program  write a java program to create an array of size 10 by taking input from bufferreader and find out the average of array elements from that array
java program
java program  write a java program to create an array of size 10 by taking input from bufferreader and find out the average of array elements from that array
java program
java program  write a java program to create an array of size 10 by taking input from bufferreader and find out the average of array elements from that array
Quries
Quries  a JAVA program to create an array of size 10 (Integer Values) by taking input from BufferReader and find out the average value of array elements from that array
Convert Text to Binary
the keyboard we have used BufferReader() method in which we have passed an object of it which is InputStreamReader() as must be knowing. Then we have defined a variable...(new InputStreamReader(System.in));   do {   try 
Convert Text to Binary
the keyboard we have used BufferReader() method in which we have passed an object of it which is InputStreamReader() as must be knowing. Then we have defined...; new BufferedReader(new InputStreamReader(System.in));   do 
What is the use of BufferedReader in Java program?
the file/input stream (source stream). With help of InputStreamReader you can read the data into character stream. The InputStreamReader class reads the bytes from stream and then decode into characters. The InputStreamReader class uses
orderbill
orderbill  write a java code to take order of number of chocolates(bar,powder,giftbox) (use arraylistand use bufferreader to take input). Also consider exceptional cases like entering integer in name use try,catch ,throw to deal
File Reader example in JRuby
" fileReader = FileReader.new "JRubyFile.txt" bufferReader... used BufferedReader's method readLine. bufferReader
Java char to string
BufferReader to read the input) Scanner splits the input into substrings consisting
How To Read File In Java with BufferedReader
the BufferedReader Class BufferedReader bufferReader = new BufferedReader
please give me an idea to develop a program for this question?
please give me an idea to develop a program for this question?  How to enter a text or number from keyboard without using InputStreamReader method in java
Input and Output problems - Java Beginners
InputStreamReader and FileReader? 2) what is buffer?   Hi friend, InputStreamReader: An InputStreamReader is a bridge from byte streams to character.... When you create an InputStreamReader, you specify an InputStream from which
Java file encoding
. In the given example, we have used InputStreamReader class that wraps the input... File("C:/file.txt"); InputStreamReader r = new InputStreamReader(new
help please!!! T_T
InputName static InputStreamReader reader= new InputStreamReader(system.in... it. import java.io.*; class InputName{ static InputStreamReader reader = new InputStreamReader(System.in); static BufferedReader input = new
restrictedproductedui
{ InputStreamReader inStream = new InputStreamReader( System.in... { InputStreamReader inStream = new InputStreamReader( System.in
How to read big file line by line in java?
); //Instantiate BufferReader class BufferedReader bufferedReader = new
JAVA assignment
to give input to a java program for the console., i mean user 1) bufferreader 2
FileIO Java Compilation - Java Beginners
this program without the BufferReader thing because i do not know what that is exactly
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads