aspose file tools*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RandomAccessFile vs FileChannel NIO