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

Print this page




  42         lastAccessTime,
  43         lastModifiedTime,
  44         isDirectory,
  45         isRegularFile,
  46         isSymbolicLink,
  47         isOther,
  48         fileKey,
  49         compressedSize,
  50         crc,
  51         method
  52     };
  53 
  54     private final ZipPath path;
  55     private final boolean isZipView;
  56 
  57     private ZipFileAttributeView(ZipPath path, boolean isZipView) {
  58         this.path = path;
  59         this.isZipView = isZipView;
  60     }
  61 

  62     static <V extends FileAttributeView> V get(ZipPath path, Class<V> type) {
  63         if (type == null)
  64             throw new NullPointerException();
  65         if (type == BasicFileAttributeView.class)
  66             return (V)new ZipFileAttributeView(path, false);
  67         if (type == ZipFileAttributeView.class)
  68             return (V)new ZipFileAttributeView(path, true);
  69         return null;
  70     }
  71 
  72     static ZipFileAttributeView get(ZipPath path, String type) {
  73         if (type == null)
  74             throw new NullPointerException();
  75         if (type.equals("basic"))
  76             return new ZipFileAttributeView(path, false);
  77         if (type.equals("zip"))
  78             return new ZipFileAttributeView(path, true);
  79         return null;
  80     }
  81 




  42         lastAccessTime,
  43         lastModifiedTime,
  44         isDirectory,
  45         isRegularFile,
  46         isSymbolicLink,
  47         isOther,
  48         fileKey,
  49         compressedSize,
  50         crc,
  51         method
  52     };
  53 
  54     private final ZipPath path;
  55     private final boolean isZipView;
  56 
  57     private ZipFileAttributeView(ZipPath path, boolean isZipView) {
  58         this.path = path;
  59         this.isZipView = isZipView;
  60     }
  61 
  62     @SuppressWarnings("unchecked") // Cast to V
  63     static <V extends FileAttributeView> V get(ZipPath path, Class<V> type) {
  64         if (type == null)
  65             throw new NullPointerException();
  66         if (type == BasicFileAttributeView.class)
  67             return (V)new ZipFileAttributeView(path, false);
  68         if (type == ZipFileAttributeView.class)
  69             return (V)new ZipFileAttributeView(path, true);
  70         return null;
  71     }
  72 
  73     static ZipFileAttributeView get(ZipPath path, String type) {
  74         if (type == null)
  75             throw new NullPointerException();
  76         if (type.equals("basic"))
  77             return new ZipFileAttributeView(path, false);
  78         if (type.equals("zip"))
  79             return new ZipFileAttributeView(path, true);
  80         return null;
  81     }
  82