How to improve RandomAccessFile usage?
<p>I'm using a <code>RandomAccessFile</code> to <strong>rw</strong> data to it constantly. The size of the file can range from 5MB up to 200MB. This file is used as a <strong>circular buffer</strong>.  </p>

<p>My main concern is the constant seek before a read and write.</p>

<p>What happens after seek? Does part of the file data get buffered right away into memory? Does it even do anything after a seek?</p>

<p>I want to understand how it works and how I could improve the performance of using the <code>RandomAccessFile</code> to read write at different positions.  I just feel the constant seek is possibly using too many resources?  </p>

<p><strong>Possible solution to avoid constant seek?</strong>  </p>

<ol>
<li>Instantiate two <code>RandomAccessFile</code> instances one to read and the other to write. Of course these would be tightly synchronized.</li>
<li>Use two <code>FileChannels</code>. Not even sure how I could prevent the pointer from moving when I need to read the tail of my buffer or the head of the buffer.</li>
</ol>
