Java DataInputStream

Java DataInputStream

What is the difference between DataInputStream and BufferedReader
View Answers

October 30, 2010 at 10:28 AM

Hi,

Here is the answer,

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.

Thanks.









Related Tutorials/Questions & Answers:
Java DataInputStream
Java DataInputStream   What is the difference between DataInputStream and BufferedReader
Java file DataInputStream
Java file DataInputStream This section demonstrates you the use of DataInputStream class. The class DataInputStream allows to read primitive Java data types... example, we have created an instance of DataInputStream class which wraps
Advertisements
Java Read File Line by Line - Java Tutorial
to write java program to read file line by line. We will use the DataInputStream... Java Read File Line by Line - Example code of reading the text file in Java one line at a time     
Java read file
There are many ways to read a file in Java. DataInputStream class is used to read text File line by line. BufferedReader is also used to read a file in Java when the file in huge. It is wrapped around FileReader. Java supports reading
java
java  how to get values using datainputstream in java
java parsing of data types
java parsing of data types  Why its not works? char ch; String s=* ch=Character.parseChar(s) program: char op; DataInputStream dis=new DataInputStream(System.in); System.out.print("Enter operator (+,-,*,/,%): "); op
programming - Java Beginners
, the DataInputStream class is used to read binary Java primitive data types in a machine...Java Programming - Getting the input from the keyboard   I need a Java program to take a input from the keyword.  For getting the input
ask - Java Beginners
"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new...://www.roseindia.net/java/ Thanks. Amardeep
different type input in java
type like as DataInputStream,Scanner i want to get source code of these all type of input method. thank   Java Read through DataInputStream: import...[] args) throws Exception{ DataInputStream in = new DataInputStream
BufferReader example in Java
default size. What is DataInputStream ?ADS_TO_REPLACE_3 From reading java data... FileInputStream, DataInputStream, BufferedReader. What is BufferedReader ?ADS_TO_REPLACE_2... DataInputStream. Example Read line by only using BufferedReader import java.io.
Java Strings problem - Java Interview Questions
Java Strings problem  How can you find a word which is repeating in maximum number of times in document, which is in text format in java?  ... of DataInputStream DataInputStream in = new DataInputStream(fstream
code problem - Java Beginners
a file that contains the following lines- java java script j2ee php sql... be changed in to "j2me". and new file containt would be like this- java java script j2ee j2me sql plz help me to sort out this problem. thnx  
code problem - Java Beginners
of DataInputStream DataInputStream in = new DataInputStream(fstream... in Java visit to : http://www.roseindia.net/java/example/java/io/ Thanks
To convert Html to pdf in java - Java Beginners
html file to pdf file using java. can any one help me out. Thanks & Regards..."); FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis...); dis = new DataInputStream(bis); String st=""; while (dis.available() != 0
java program - Java Beginners
java program  sir,i'm asked to write a program in java on below question. Design a java interface for ADT stack.Develop two different class... = -1; public void push() { try { DataInputStream dis = new
java programs - Java Beginners
java programs  design a java interface for adt stack .develop two...[] = new int[n]; int top = -1; public void push() { try { DataInputStream dis = new DataInputStream(System.in); System.out.println("Enter Element"); int
java - Java Beginners
java  Design a Java interface for ADT Stack. Develop two different...; public void push(){ try{ DataInputStream dis=new DataInputStream(System.in...{ DataInputStream dis=new DataInputStream(System.in); StackImplementation stk=new
java - Java Beginners
java  "Design a Java interface for ADT Stack. Develop two different...]; int top = -1; public void push() { try { DataInputStream dis = new DataInputStream(System.in); System.out.println("Enter Element"); int ele
java - Java Beginners
java  design a java interface for adt stack----its is one of lab...; public void push() { try { DataInputStream dis = new DataInputStream(System.in... arg[]) throws IOException { DataInputStream dis = new DataInputStream(System.in
programming - Java Beginners
looking for a sample code to list all even numbers between two numbers in JAVA. Thanks!  Program to list all even numbers between two numbers in JAVA... void main(String[] args){ try{ DataInputStream d=new DataInputStream(System.in
FileHandling - Java Beginners
FileHandling  Q. Write a java prg which accepts a list of existing...); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new...); FileInputStream fstream1 = new FileInputStream(file1); DataInputStream in1 = new
ADT stack - Java Beginners
ADT stack  Design a Java interface for ADT Stack. Develop two... { DataInputStream dis = new DataInputStream(System.in); System.out.println("Enter Element... IOException { DataInputStream dis = new DataInputStream(System.in
java - Design concepts & design patterns
java  design a java interface for ADT stack.develop two differant... int[n]; int top = -1; public void push() { try { DataInputStream dis = new DataInputStream(System.in); System.out.println("Enter Element
Java Stack ADT
Java Stack ADT You all are familiar with the data structure 'Stack'. The Stack... the only element that can be inspected. Here we have designed a Java interface for ADT... top = -1; public void push() { try { DataInputStream dis = new
java - Java Beginners
java  write a java application to open the file & display...; BufferedInputStream bis = null; DataInputStream dis = null; String data... BufferedInputStream(fis); dis = new DataInputStream(bis); while (dis.available
Count characters from text file in Java
mtext file in Java". I tried to run the code, but the error at the line have... is a java code that count the occurrence of each character from text file. import... FileInputStream("C:\\data.txt"); DataInputStream in = new DataInputStream(fstream
Java read text file
Java classes and Interfaces are used:ADS_TO_REPLACE_1 DataInputStream Class: DataInputStream class reads primitive data from any input stream and output... have used FileInputStream, DataInputStream and BufferedReader classes to read
count occourance no of time no between 0 to 9 given by user in java
]; int i,temp=0; DataInputStream dis=new DataInputStream...); }catch(Exception e){} } }   Here is a java
How to Read file line by line in Java program
by line in Java. But there are various ways that can help read a larger file... having less amount of memory. In the example of Java Read line by line below.... DataInputStream Class extends java.io.FilterInputStream. It reads primitive data types
java test
java test  How to read the data from an .csv file and write into an xml file using java? (test_sample.csv(it should contain at least 39 lines)) i..."); // DataInputStream br= new DataInputStream(fStream); String s=null
java - read file line by line in Java
java - read file line by line in Java  Hi, how one can read a text file line by line in Java? What is the benefits of reading a file line by line in Java? Why I can't read a big text file in memory? Thanks   A text
Java error reading from file
Java error reading from file       Java error reading file are the common error occurred  in java that when the user encounter a corrupt file
JSP Code - Java Beginners
JSP Code  can i show list of uploaded files in java then view one...) && (contentType.indexOf("multipart/form-data") >= 0)) { DataInputStream in = new DataInputStream(request.getInputStream()); int formDataLength
java code - Swing AWT
java code  Hello .anyone can plz tell me code for this .First create...{ FileInputStream fstream = new FileInputStream("studentRecord.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader
ARRAYS - Java Beginners
n=input.nextLine(); DataInputStream in = new DataInputStream(new... the following link: http://www.roseindia.net/tutorial/java/core/assignSeats.html
Java read file line by line - Java Tutorial
C:\nisha>javac ReadFile.java C:\nisha>java...;);   // Get the object of DataInputStream   DataInputStream in = new DataInputStream(fstream
What is the fastest way to read a file in Java?
What is the fastest way to read a file in Java?  Hi, I am reading my... of Java. Here is the sample code you can use: FileInputStream fstream = new FileInputStream("textfile.txt"); DataInputStream in = new DataInputStream(fstream
java a - Java Beginners
java a  i will ask iam using servlets ,in one program my...") >= 0)) { DataInputStream in = new DataInputStream(request.getInputStream...)) { DataInputStream in = new DataInputStream(request.getInputStream()); int
JAVA - Java Beginners
JAVA  Write a Java program to read a file that contains DNA sequences of arbitrary length one per line  Hi Friend, Try the following..."); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new
Java - Java Beginners
Java  1.Write a Java program to read a file that contains DNA sequences of arbitrary length one per line (note that each DNA sequence is just...:/school.txt"); DataInputStream in = new DataInputStream(fstream
Search word from text file using Java
How to Search word from text file using Java In this section, we are going... FileInputStream( "studentRecord.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader( new
Java
Java  how to upload file in jsp?   JSP upload file 1)page.jsp: <%@ page language="java" %> <HTML> <HEAD><TITLE>...("multipart/form-data") >= 0)){ DataInputStream in = new DataInputStream
java source code - Java Beginners
java source code  hello Sir, Im a beginner in java.im greatly...); DataInputStream in = new DataInputStream(fstream); BufferedReader br... FileInputStream( new File("directory.txt")); DataInputStream dis = new
How to read file in java
How to read file in java Java provides IO package to perform reading... file line by line  in java. FileInputStream- This class reads bytes from... to read file in Java?" Another way of reading a file: The another
Read File from specified path in Java
How to read a file from a specified path in Java? After learning so many examples of file handling in  Java, we will show to a simple program which reads a text file from specified path in Java. We will give complete path
initialise array by reading from file - Java Beginners
("textfile.txt"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader
Java Telephone directory management system
Java Telephone directory management system Here we are going to create a java... FileInputStream(file); DataInputStream in = new DataInputStream(fstream...")); DataInputStream dis = new DataInputStream(fis); BufferedReader
java error - Java Beginners
java error  Thanks for providing me the answer for the question... the errors and provide the coding that run properly Write a Java program... Friend, Save java file with 'SortFileData.java' and try the following code
java - Java Beginners
java  Write a Java program to read a file that contains DNA sequences of arbitrary length one per line (note that each DNA sequence is just a String..."); DataInputStream in = new DataInputStream(fstream); BufferedReader br
java - Java Beginners
java  6. Write a Java program to read a file that contains DNA sequences of arbitrary length one per line (note that each DNA sequence is just..."); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new

Ads