This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread 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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "IO streams" Watch "IO streams" New topic

IO streams

Mahesh Kumar Chintakayala

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.
sajja bala

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
I agree. Here's the link:
subject: IO streams
jQuery in Action, 3rd edition