@Override protected Long getDefaultPositionPerFile(File file) throws IOException { if (this.defaultTimestampIsFileUpdated) { BasicFileAttributeView fileAttributeView = Files.getFileAttributeView(file.toPath(), BasicFileAttributeView.class); BasicFileAttributes readAttributes = fileAttributeView.readAttributes(); return AbsoluteTimeGranularityUtil.asPosition( new Date(readAttributes.lastModifiedTime().toMillis())); } else if (this.defaultDate != null) { return this.defaultDate.getTime(); } else { return super.getDefaultPositionPerFile(file); } }
private void setFileCreationDate(File f, long time) throws IOException { BasicFileAttributeView attributes = Files.getFileAttributeView(f.toPath(), BasicFileAttributeView.class); FileTime creationTime = FileTime.fromMillis(time); attributes.setTimes(creationTime, creationTime, creationTime); }