Files.getFileAttributeView(Path path, Class <V> type, LinkOption ... options) has the following syntax.
public static <V extends FileAttributeView > V getFileAttributeView(Path path, Class <V> type, LinkOption ... options)
In the following code shows how to use Files.getFileAttributeView(Path path, Class <V> type, LinkOption ... options) method.
//w ww . j a va2 s . co m import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.FileTime; public class Main { public static void main(String[] args) { Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt"); long time = System.currentTimeMillis(); FileTime fileTime = FileTime.fromMillis(time); try { BasicFileAttributeView bv = Files.getFileAttributeView(path, BasicFileAttributeView.class); bv.setTimes(fileTime, fileTime, fileTime); } catch (IOException e) { System.err.println(e); } } }