• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

NX:Using RandomAccessFile and FileChannel

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using RandomAccessFile to read my DB file. I noticed is some other
posts people using RandomAccessFile to read the header and then retrieving
a FileChannel to read in the data.
What is the advantage of the FileChannel? Can't you just use RandomAccessFile for reading the entire file?
 
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bill,
There is no requirement in the assignment dictating the choice of RAF v/s filechannels. As a matter of fact, you can do the whole IO using "old" style Random Access Files all-together (that is what I did). The NIO (new IO) package/capability introduced in jdk 1.4 + has improved the IO speed and allowed for bi-directional read/write channels etc. I am staying away from it until I finish the entire assignment and then may be work on introducing file-channels (the keywords being "may be"). It depends on what you can get more comfortable with in a reasonable amount of time.
Regards.
Bharat
 
I am displeased. You are no longer allowed to read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic