File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "RandomAccessFile vs FileChannel NIO" Watch "RandomAccessFile vs FileChannel NIO" New topic

RandomAccessFile vs FileChannel NIO

Dan Hop

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 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).

I agree. Here's the link:
subject: RandomAccessFile vs FileChannel NIO
It's not a secret anymore!