FileLock is not working in Mac OS - Used in Javafx application
992458Feb 26 2013 — edited Feb 26 2013In my application, there is pause & resume functionality on the file download.
To achieve this, we used java.nio.channels.FileLock to lock the file.
It is working fine in Windows, not in Macintosh OS 10.8.
We are using JRE 1.7 u 15 to run the application.
Here is the code I am using to lock a file which is working fine in Windows, but not in Macintosh
FileOutputStream file = null;
FileChannel dbFc = null;
FileLock dbFl = null;
file = new FileOutputStream( new File(sFilePath));
dbFc = file.getChannel();
dbFl = dbFc.lock();
file.write(buffer,0,read);
When I am applying lock on the FileChannel, it is not able to lock on Mac OS systems.
Is there any alternate I can use instead of FileLock .
All this logic is part of JavaFx application which will run from user's machine
Please suggest