Java 7: Déterminer la date de création et la taille d’un fichier

Author:

 int,string,char,static, url, socket, url, socket, java
Download

 
package java7exemples;
 
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
public class FileAttributs
{
          public static void main(String[] args)
           {
                try
                   {
                    Path path = FileSystems.getDefault().getPath("c:/test.txt");
                    System.out.println("Taille: "+Files.getAttribute(path, "size",""));
                    System.out.println( "Date Création création"+Files.getAttribute( path, "creationTime" ) );
                    }
                catch (IOException ex)
                {
                System.out.println("IOException: "+ex);
                }
          }
}