attributes - BasicFileAttributes vs BasicFileAttributeView in Java -


what difference between these 2 interfaces? basicfileattributes vs basicfileattributeview

i understand serve retrieve basic metadata file, differs each other?

edit: meant in following example 2 interfaces used interchangeably. there difference @ all? besides fact in order access attributes view first have call .readattributes() method?

basicfileattributeview bs = files.getfileattributeview(path, basicfileattributeview.class);         basicfileattributes bfa = files.readattributes(path, basicfileattributes.class); 

interfaces nothing signatures describe. difference between these 2 interfaces are, demand methods of other signatures implemented.

if have basicfileattributeview instance, can basicfileattributes using readattributes(). if don't have basicfileattributeview instance, can using files.getfileattributeview. guaranteed can one, if can't every instance of every subclass of fileattributeview.

example:

basicfileattributeview  bfav    = files.getfileattributeview(                                    filesystems.getdefault().getpath("/dev/null"),                                    basicfileattributeview.class                                   ); basicfileattributes     bfa     = bfav.readattributes(); system.out.println(new date(bfa.lastaccesstime().tomillis())); 
  1. we default filesystem, can use in next step.
  2. we path using filesystem, can use in next step
  3. we basicfileattributeview (which represents ability read basicfileattribute) using path, ...
  4. we basicfileattribute using basicfileattributeview, ...
  5. we lastaccesstime (a filetime), ...
  6. we milliseconds previous
  7. we date previous

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -