src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java

Print this page




 756             if (zfs.isReadOnly())
 757                 throw new AccessDeniedException(toString());
 758         }
 759         if (x)
 760             throw new AccessDeniedException(toString());
 761     }
 762 
 763     boolean exists() {
 764         if (path.length == 1 && path[0] == '/')
 765             return true;
 766         try {
 767             return zfs.exists(getResolvedPath());
 768         } catch (IOException x) {}
 769         return false;
 770     }
 771 
 772     OutputStream newOutputStream(OpenOption... options) throws IOException
 773     {
 774         if (options.length == 0)
 775             return zfs.newOutputStream(getResolvedPath(),
 776                                        CREATE_NEW, WRITE);
 777         return zfs.newOutputStream(getResolvedPath(), options);
 778     }
 779 
 780     void move(ZipPath target, CopyOption... options)
 781         throws IOException
 782     {
 783         if (Files.isSameFile(this.zfs.getZipFile(), target.zfs.getZipFile()))
 784         {
 785             zfs.copyFile(true,
 786                          getResolvedPath(), target.getResolvedPath(),
 787                          options);
 788         } else {
 789             copyToTarget(target, options);
 790             delete();
 791         }
 792     }
 793 
 794     void copy(ZipPath target, CopyOption... options)
 795         throws IOException
 796     {




 756             if (zfs.isReadOnly())
 757                 throw new AccessDeniedException(toString());
 758         }
 759         if (x)
 760             throw new AccessDeniedException(toString());
 761     }
 762 
 763     boolean exists() {
 764         if (path.length == 1 && path[0] == '/')
 765             return true;
 766         try {
 767             return zfs.exists(getResolvedPath());
 768         } catch (IOException x) {}
 769         return false;
 770     }
 771 
 772     OutputStream newOutputStream(OpenOption... options) throws IOException
 773     {
 774         if (options.length == 0)
 775             return zfs.newOutputStream(getResolvedPath(),
 776                                        CREATE, TRUNCATE_EXISTING, WRITE);
 777         return zfs.newOutputStream(getResolvedPath(), options);
 778     }
 779 
 780     void move(ZipPath target, CopyOption... options)
 781         throws IOException
 782     {
 783         if (Files.isSameFile(this.zfs.getZipFile(), target.zfs.getZipFile()))
 784         {
 785             zfs.copyFile(true,
 786                          getResolvedPath(), target.getResolvedPath(),
 787                          options);
 788         } else {
 789             copyToTarget(target, options);
 790             delete();
 791         }
 792     }
 793 
 794     void copy(ZipPath target, CopyOption... options)
 795         throws IOException
 796     {