This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ReadAccessFile problem  RSS feed

 
Dave Winters
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm new to the ranch and I am currently studying and taking the Sun Certified developer exam, I have a simple question regarding the ReadAccessFile class. Im trying to read a text file using this class.
An example of the format of this file is:

recid firstname lastname
2 james joyce

Im trying to read in firstly the recid, then the firstname and then the lastname and store each in their appropriate type.
Any help would be greatly appreciated and I hope thyat I wilol be able to respond to nay queries others may have in the future.

Thanks in advance,

Dave :roll:
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Dave.
Do you mean RandomAccessFile? Have you looked at the documentation? there's specific methods to read different types. It's a poor choice to use on a text file. It is better suited to reading binary files with fixed-length records. Take a gander at the Java Tutorial chapter on IO and you'll better understand what choices you have in reading and writing files.
 
Dave Winters
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, I had a look at the documentation and eventally worked it out.

Thanks again,

Dave
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!