This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Performance and the fly likes RandomAccessFile vs FileChannel NIO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "RandomAccessFile vs FileChannel NIO" Watch "RandomAccessFile vs FileChannel NIO" New topic
Author

RandomAccessFile vs FileChannel NIO

Dan Hop
Greenhorn

Joined: Aug 02, 2010
Posts: 7
Hi Folks, I was wondering if anyone else has been down this road before..

Basically I need to read a portion of a text file (log file), that is being written to constantly, and transfer the delta off into a 'new' gzip file.
i.e. every x minutes capture what has changed, dump it off to gzip file, or stream (i.e. I will be sending the gzip data off via an HTTP post to another box).
note: the assumption is that the delta will NOT fit in memory.

I was thinking I would use RandomAccessFile,and simply update the ByteOffset, after each iteration...my question is..should I bother investigating using something like FileChannel/NIO for this (I suspect the FileChannel solution maybe faster..but the question is ... how significantly faster).

thanks
Dano
 
Consider Paul's rocket mass heater.
 
subject: RandomAccessFile vs FileChannel NIO
 
Similar Threads
Simple question about closing files/channels
NX: about updataRecord
what is the most optimized way of writing a file
NX: (Contractors) File I/O class
NIO