Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners bufferReader and InputStreamReader
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


bufferReader and InputStreamReader are used for what purpose?


Advertisement
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();
        }
    }
}


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 br = new BufferedReader(new InputStreamReader(in)); String
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
 

 

 

DMCA.com