0

plz any buddy share demo program about file version control of any document and how can uniquely identify that document at the time of when we uploading.

http://java2s.com/Tutorials/Java/java.nio.file.attribute/BasicFileAttributes/Java_BasicFileAttributes_fileKey_.htm#Example

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
public class Main
{
  public static void main(String[] args) throws Exception  
  {
    BasicFileAttributes attr = null;
    Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt");
    attr = Files.readAttributes(path, BasicFileAttributes.class);
    System.out.println(attr.fileKey());
  }
}
MasterV
  • 29
  • 6

1 Answers1

0

You seem to be mixing some concepts here: you are talking file version control but filesystem attributes.

A FileAttribute is what its name says: an attribute for a file. What attributes are defined depend on the FileSystem implementation. Paths.get() will return a Path from the default FileSystem.

For instance, files on a Unix system will have attributes to tell whether the file can be read/written/executed by user/group/other. Files on a DOS filesystem will have attributes such as hidden.

But those are dependent on the filesystem. If you copy a file from one system to another, you will lose these attributes.

One can imagine however to write a FileSystem implementation for CVS for instance, where each file has a version; then you could define a CVSFileAttribute with a version, yes.

fge
  • 119,121
  • 33
  • 254
  • 329
  • thanx..so how can atually implement version control and how can uniquely identify any document. beacause i was search about filekey(). it is uniquely identfy any file.. but i dont know how is possible..so plz help me.. – MasterV Mar 17 '14 at 07:11
  • Just use an existing version control system such as git – fge Mar 17 '14 at 07:14
  • i dont know git..some explanation or any futher link about it..plz share me..or any demo program if u have?? – MasterV Mar 17 '14 at 07:24