Hello Guys
Here, I am writing about extract the metadata of the file in java technology in which you can extract file creation date, file access date, modification date, size etc. Java provide inbuild BasicFileAttributes class in the JDK.
MetaData is a useful details of the file that is attached with file and metadata have many attributes as below :
File name
File creation date
File access date
File modification date
File tag
File description
Below example help you to better understand :
BasicFileAttributes attr = Files.readAttributes("/image/bhagwan.jpg", BasicFileAttributes.class);//Reading basic attribute/metadata of the file
// extracting the attribute/metadata of the file
System.out.println("creationTime: " + attr.creationTime());
System.out.println("lastAccessTime: " + attr.lastAccessTime());
System.out.println("lastModifiedTime: " + attr.lastModifiedTime());
System.out.println("isDirectory: " + attr.isDirectory());
System.out.println("isOther: " + attr.isOther());
System.out.println("isRegularFile: " + attr.isRegularFile());
0 Comment(s)