I'm using a FileLock to prevent the deletion of a .zip file but I can't open it. So I'm trying to find something to block the file but be able to open it. There is my code :
File file = new File(myfile);
FileInputStream in = new FileInputStream(file);
FileChannel channel = new RandomAccessFile(file, "rw").getChannel();
FileLock lock = channel.lock();
try {
lock = channel.tryLock();
} catch (OverlappingFileLockException e) {}
Thanks !