A
ak
The method skipBytes in RandomAccessFile is documumented as giving no
no, you should skipBytes in a loop (add skipped bytes till you have needed
value)
and throw EOFException only if return walue was negative.
However, with RandomAccessFile is better to use seek();
guarantee that the bytes requested will be skipped, returning instead the
actual number skipped.
The method description seems to be copied directly from interface DataInput
and I suspect this is why is left so open.
Surely RAF.skipBytes() should document the reasons why the request may not
succeed.
<quote>
This method may skip over some smaller number of bytes, possibly zero. This
may result from any of a number of conditions; reaching end of file before n
bytes have been skipped is only one possibility.
</quote>
So what are the other possibilities?
Perhaps I should just check the return value and throw IOException if it is
not as requested.
no, you should skipBytes in a loop (add skipped bytes till you have needed
value)
and throw EOFException only if return walue was negative.
However, with RandomAccessFile is better to use seek();