This content has been marked as final. Show 5 replies
First of all tryLock() method gets an exclusive lock on file, so you should release it after use, so that any other programs in VM may use the same file if need arises. Afterwards you may close the channel and then file.
Here are some links:
I assumed java 1.5 . Hope this was helpful.
Thanks for reply,
Continue from previous post
If i close the filechannel, after wards do i have to close RandomAccessFile object.
Or closing fileChannel is enough.
Thanks for reply.
Damn. I am really sorry but "Yes" was not mean as an answer in this thread.
Answer to your question is no. Closing the channel automatically closes the stream. Again, sorry for the confusion.