我正在通过fuse (FUSE-JNA)编写日志文件系统。我想做的是
它就像web服务器日志一样。
为此,我认为实现open()和release()方法是可行的:
public int open(final String path, final FileInfoWrapper info)
{
System.out.println("open called: Path="+path); //replaced with code for inserting current time in database table
return 0;
}
@Override
public int release(final String path, final FileInfoWrapper info)
{
System.out.println("release called: Path="+path);//replaced with code for inserting current time in database table
return 0;
}1-当我打开文件时调用这些方法,这很好。
2-但是当我打开文件夹时,对文件夹中的每个文件也会调用这些方法。
我会如何区分这两者。因为我只需要在用户打开文件和关闭时间时插入时间。当用户打开目录时不会。
有人帮忙吗?
发布于 2014-07-15 18:47:35
使用java.nio.File isFile()和isDirectory()来区分两者。
https://stackoverflow.com/questions/22447253
复制相似问题