uniqueidentifier - Is there an external library equivalent to BasicFileAttributes in Java? Specifically the method fileKey? -
for project i'm working on need locate inode/fileid. unique identifier individual files in operating system can keep track of them if renamed or moved.
it recommended use basicfileattributes::filekey find , should work perfectly. problem need develop java 6 , basicfileattributes needs java 7.
unfortunately it's not option use java 7, have suggestions external library can provide same functionality?
it mentioned scripting command prompt (i'm using windows 7) try locate it.
thanks , help/suggestions.
this implementation came with:
public static class filekey { private file file; public filekey(file file) { this.file=file; } @override public int hashcode() { long res = file.length(); res+=file.lastmodified(); if(file.ishidden()) res+=2; if(file.isdirectory()) { res+=3; } return (int) res; } @override public boolean equals(object dst) { if(dst instanceof filekey) { int dsthashcode = ((filekey) dst).hashcode(); return dsthashcode == this.hashcode(); } return false; } }
just use filekey object.
Comments
Post a Comment