我正在使用FileLock来阻止删除.zip文件但我无法打开它。所以我试图找到阻止文件但能够打开它的东西。 有我的代码:
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) {}
谢谢!
答案 0 :(得分:0)
OH no ok Channels.newChannel(in)
完美无缺