This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes I/O and Streams and the fly likes IO streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "IO streams" Watch "IO streams" New topic
Author

IO streams

Mahesh Kumar Chintakayala
Greenhorn

Joined: Dec 12, 2007
Posts: 2
what is the difference between DataInputStrean and RandomAccessFile
Amir Alagic
Ranch Hand

Joined: Mar 21, 2006
Posts: 65
You often want to read or write data at random positions within a file, rather than sequentially as you would with a magnetic tape. The RandomAccessFile class behaves like a combined DataOutputStream and DataInputStream. RandomAccessFile implements both the DataOutput and DataInput interfaces. RandomAccessFile objects are created from a String filename or File object like other stream objects, but a mode constructor argument is also required.
http://www.cs.usfca.edu/~parrt/course/601/lectures/io.html
sajja bala
Greenhorn

Joined: Dec 12, 2007
Posts: 11
Hi Mahesh

First you go through the API and ask the question of RandomAccessFile and Data...........


Have a Good Day........<br />Sajj Bala Subrahmanyam
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Streams are like rivers ... you can't really ask them to back up. The IO chapter in Eckell's Thinking In Java (free online) breaks down the confusing hierarchy of IO classes pretty well.

BTW: The languages I used could SEEK and READ BACKWARDS on magnetic tape. It used to be great fun to watch a bank of 8 tape drives do sorts, running backwards and forwards all over the place. You could see the sort algorithm at work and easily tell how well sorted the input was.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
Consider Paul's rocket mass heater.
 
subject: IO streams