87 if (!attrs.isRegularFile())
88 throw new UnsupportedOperationException();
89 return true;
90 } catch (IOException ioe) {
91 return false;
92 }
93 }
94
95 @Override
96 public FileSystem newFileSystem(URI uri, Map<String, ?> env)
97 throws IOException
98 {
99 Path path = uriToPath(uri);
100 synchronized(filesystems) {
101 Path realPath = null;
102 if (ensureFile(path)) {
103 realPath = path.toRealPath();
104 if (filesystems.containsKey(realPath))
105 throw new FileSystemAlreadyExistsException();
106 }
107 ZipFileSystem zipfs = null;
108 try {
109 if (env.containsKey("multi-release")) {
110 zipfs = new JarFileSystem(this, path, env);
111 } else {
112 zipfs = new ZipFileSystem(this, path, env);
113 }
114 } catch (ZipException ze) {
115 String pname = path.toString();
116 if (pname.endsWith(".zip") || pname.endsWith(".jar"))
117 throw ze;
118 // assume NOT a zip/jar file
119 throw new UnsupportedOperationException();
120 }
121 if (realPath == null) { // newly created
122 realPath = path.toRealPath();
123 }
124 filesystems.put(realPath, zipfs);
125 return zipfs;
126 }
127 }
|
87 if (!attrs.isRegularFile())
88 throw new UnsupportedOperationException();
89 return true;
90 } catch (IOException ioe) {
91 return false;
92 }
93 }
94
95 @Override
96 public FileSystem newFileSystem(URI uri, Map<String, ?> env)
97 throws IOException
98 {
99 Path path = uriToPath(uri);
100 synchronized(filesystems) {
101 Path realPath = null;
102 if (ensureFile(path)) {
103 realPath = path.toRealPath();
104 if (filesystems.containsKey(realPath))
105 throw new FileSystemAlreadyExistsException();
106 }
107 ZipFileSystem zipfs;
108 try {
109 if (env.containsKey("multi-release")) {
110 zipfs = new JarFileSystem(this, path, env);
111 } else {
112 zipfs = new ZipFileSystem(this, path, env);
113 }
114 } catch (ZipException ze) {
115 String pname = path.toString();
116 if (pname.endsWith(".zip") || pname.endsWith(".jar"))
117 throw ze;
118 // assume NOT a zip/jar file
119 throw new UnsupportedOperationException();
120 }
121 if (realPath == null) { // newly created
122 realPath = path.toRealPath();
123 }
124 filesystems.put(realPath, zipfs);
125 return zipfs;
126 }
127 }
|