< prev index next >

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

Print this page
rev 54573 : 8222532: (zipfs) Performance regression when writing ZipFileSystem entries in parallel
Reviewed-by: TBD


 659             WatchEvent.Modifier... modifiers) {
 660         if (watcher == null || events == null || modifiers == null) {
 661             throw new NullPointerException();
 662         }
 663         // watcher must be associated with a different provider
 664         throw new ProviderMismatchException();
 665     }
 666 
 667     @Override
 668     public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) {
 669         return register(watcher, events, new WatchEvent.Modifier[0]);
 670     }
 671 
 672     @Override
 673     public final File toFile() {
 674         throw new UnsupportedOperationException();
 675     }
 676 
 677     @Override
 678     public Iterator<Path> iterator() {
 679         return new Iterator<Path>() {
 680             private int i = 0;
 681 
 682             @Override
 683             public boolean hasNext() {
 684                 return (i < getNameCount());
 685             }
 686 
 687             @Override
 688             public Path next() {
 689                 if (i < getNameCount()) {
 690                     Path result = getName(i);
 691                     i++;
 692                     return result;
 693                 } else {
 694                     throw new NoSuchElementException();
 695                 }
 696             }
 697 
 698             @Override
 699             public void remove() {


 729 
 730     void delete() throws IOException {
 731         zfs.deleteFile(getResolvedPath(), true);
 732     }
 733 
 734     void deleteIfExists() throws IOException {
 735         zfs.deleteFile(getResolvedPath(), false);
 736     }
 737 
 738     ZipFileAttributes getAttributes() throws IOException
 739     {
 740         ZipFileAttributes zfas = zfs.getFileAttributes(getResolvedPath());
 741         if (zfas == null)
 742             throw new NoSuchFileException(toString());
 743         return zfas;
 744     }
 745 
 746     void setAttribute(String attribute, Object value, LinkOption... options)
 747         throws IOException
 748     {
 749         String type = null;
 750         String attr = null;
 751         int colonPos = attribute.indexOf(':');
 752         if (colonPos == -1) {
 753             type = "basic";
 754             attr = attribute;
 755         } else {
 756             type = attribute.substring(0, colonPos++);
 757             attr = attribute.substring(colonPos);
 758         }
 759         ZipFileAttributeView view = ZipFileAttributeView.get(this, type);
 760         if (view == null)
 761             throw new UnsupportedOperationException("view <" + view + "> is not supported");
 762         view.setAttribute(attr, value);
 763     }
 764 
 765     void setTimes(FileTime mtime, FileTime atime, FileTime ctime)
 766         throws IOException
 767     {
 768         zfs.setTimes(getResolvedPath(), mtime, atime, ctime);
 769     }
 770 
 771     Map<String, Object> readAttributes(String attributes, LinkOption... options)
 772         throws IOException
 773 
 774     {
 775         String view = null;
 776         String attrs = null;
 777         int colonPos = attributes.indexOf(':');
 778         if (colonPos == -1) {
 779             view = "basic";
 780             attrs = attributes;
 781         } else {
 782             view = attributes.substring(0, colonPos++);
 783             attrs = attributes.substring(colonPos);
 784         }
 785         ZipFileAttributeView zfv = ZipFileAttributeView.get(this, view);
 786         if (zfv == null) {
 787             throw new UnsupportedOperationException("view not supported");
 788         }
 789         return zfv.readAttributes(attrs);
 790     }
 791 
 792     FileStore getFileStore() throws IOException {
 793         // each ZipFileSystem only has one root (as requested for now)
 794         if (exists())
 795             return zfs.getFileStore(this);
 796         throw new NoSuchFileException(zfs.getString(path));




 659             WatchEvent.Modifier... modifiers) {
 660         if (watcher == null || events == null || modifiers == null) {
 661             throw new NullPointerException();
 662         }
 663         // watcher must be associated with a different provider
 664         throw new ProviderMismatchException();
 665     }
 666 
 667     @Override
 668     public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) {
 669         return register(watcher, events, new WatchEvent.Modifier[0]);
 670     }
 671 
 672     @Override
 673     public final File toFile() {
 674         throw new UnsupportedOperationException();
 675     }
 676 
 677     @Override
 678     public Iterator<Path> iterator() {
 679         return new Iterator<>() {
 680             private int i = 0;
 681 
 682             @Override
 683             public boolean hasNext() {
 684                 return (i < getNameCount());
 685             }
 686 
 687             @Override
 688             public Path next() {
 689                 if (i < getNameCount()) {
 690                     Path result = getName(i);
 691                     i++;
 692                     return result;
 693                 } else {
 694                     throw new NoSuchElementException();
 695                 }
 696             }
 697 
 698             @Override
 699             public void remove() {


 729 
 730     void delete() throws IOException {
 731         zfs.deleteFile(getResolvedPath(), true);
 732     }
 733 
 734     void deleteIfExists() throws IOException {
 735         zfs.deleteFile(getResolvedPath(), false);
 736     }
 737 
 738     ZipFileAttributes getAttributes() throws IOException
 739     {
 740         ZipFileAttributes zfas = zfs.getFileAttributes(getResolvedPath());
 741         if (zfas == null)
 742             throw new NoSuchFileException(toString());
 743         return zfas;
 744     }
 745 
 746     void setAttribute(String attribute, Object value, LinkOption... options)
 747         throws IOException
 748     {
 749         String type;
 750         String attr;
 751         int colonPos = attribute.indexOf(':');
 752         if (colonPos == -1) {
 753             type = "basic";
 754             attr = attribute;
 755         } else {
 756             type = attribute.substring(0, colonPos++);
 757             attr = attribute.substring(colonPos);
 758         }
 759         ZipFileAttributeView view = ZipFileAttributeView.get(this, type);
 760         if (view == null)
 761             throw new UnsupportedOperationException("view <" + view + "> is not supported");
 762         view.setAttribute(attr, value);
 763     }
 764 
 765     void setTimes(FileTime mtime, FileTime atime, FileTime ctime)
 766         throws IOException
 767     {
 768         zfs.setTimes(getResolvedPath(), mtime, atime, ctime);
 769     }
 770 
 771     Map<String, Object> readAttributes(String attributes, LinkOption... options)
 772         throws IOException
 773 
 774     {
 775         String view;
 776         String attrs;
 777         int colonPos = attributes.indexOf(':');
 778         if (colonPos == -1) {
 779             view = "basic";
 780             attrs = attributes;
 781         } else {
 782             view = attributes.substring(0, colonPos++);
 783             attrs = attributes.substring(colonPos);
 784         }
 785         ZipFileAttributeView zfv = ZipFileAttributeView.get(this, view);
 786         if (zfv == null) {
 787             throw new UnsupportedOperationException("view not supported");
 788         }
 789         return zfv.readAttributes(attrs);
 790     }
 791 
 792     FileStore getFileStore() throws IOException {
 793         // each ZipFileSystem only has one root (as requested for now)
 794         if (exists())
 795             return zfs.getFileStore(this);
 796         throw new NoSuchFileException(zfs.getString(path));


< prev index next >