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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -