jdk/test/demo/zipfs/ZipFSTester.java
changeset 18150 237f3c2875aa
parent 17910 82d10099a8a6
child 21596 0e3a39f29dbc
equal deleted inserted replaced
18149:5997c9aedb0e 18150:237f3c2875aa
   339         Files.delete(fs3Path);
   339         Files.delete(fs3Path);
   340     }
   340     }
   341 
   341 
   342     // test file stamp
   342     // test file stamp
   343     static void testTime(Path src) throws Exception {
   343     static void testTime(Path src) throws Exception {
       
   344         BasicFileAttributes attrs = Files
       
   345                         .getFileAttributeView(src, BasicFileAttributeView.class)
       
   346                         .readAttributes();
   344         // create a new filesystem, copy this file into it
   347         // create a new filesystem, copy this file into it
   345         Map<String, Object> env = new HashMap<String, Object>();
   348         Map<String, Object> env = new HashMap<String, Object>();
   346         env.put("create", "true");
   349         env.put("create", "true");
   347         Path fsPath = getTempPath();
   350         Path fsPath = getTempPath();
   348         FileSystem fs = newZipFileSystem(fsPath, env);
   351         FileSystem fs = newZipFileSystem(fsPath, env);
   350         System.out.println("test copy with timestamps...");
   353         System.out.println("test copy with timestamps...");
   351         // copyin
   354         // copyin
   352         Path dst = getPathWithParents(fs, "me");
   355         Path dst = getPathWithParents(fs, "me");
   353         Files.copy(src, dst, COPY_ATTRIBUTES);
   356         Files.copy(src, dst, COPY_ATTRIBUTES);
   354         checkEqual(src, dst);
   357         checkEqual(src, dst);
   355 
       
   356         BasicFileAttributes attrs = Files
       
   357                         .getFileAttributeView(src, BasicFileAttributeView.class)
       
   358                         .readAttributes();
       
   359         System.out.println("mtime: " + attrs.lastModifiedTime());
   358         System.out.println("mtime: " + attrs.lastModifiedTime());
   360         System.out.println("ctime: " + attrs.creationTime());
   359         System.out.println("ctime: " + attrs.creationTime());
   361         System.out.println("atime: " + attrs.lastAccessTime());
   360         System.out.println("atime: " + attrs.lastAccessTime());
   362         System.out.println(" ==============>");
   361         System.out.println(" ==============>");
   363         BasicFileAttributes dstAttrs = Files
   362         BasicFileAttributes dstAttrs = Files