129 checkPermission();
130 checkUri(uri);
131 return getTheFileSystem();
132 }
133
134 // Checks that the given file is a JrtPath
135 static final JrtPath toJrtPath(Path path) {
136 if (path == null)
137 throw new NullPointerException();
138 if (!(path instanceof JrtPath))
139 throw new ProviderMismatchException();
140 return (JrtPath)path;
141 }
142
143 @Override
144 public void checkAccess(Path path, AccessMode... modes) throws IOException {
145 toJrtPath(path).checkAccess(modes);
146 }
147
148 @Override
149 public void copy(Path src, Path target, CopyOption... options)
150 throws IOException
151 {
152 toJrtPath(src).copy(toJrtPath(target), options);
153 }
154
155 @Override
156 public void createDirectory(Path path, FileAttribute<?>... attrs)
157 throws IOException
158 {
159 toJrtPath(path).createDirectory(attrs);
160 }
161
162 @Override
163 public final void delete(Path path) throws IOException {
164 toJrtPath(path).delete();
165 }
166
167 @Override
168 @SuppressWarnings("unchecked")
169 public <V extends FileAttributeView> V
170 getFileAttributeView(Path path, Class<V> type, LinkOption... options)
171 {
172 return JrtFileAttributeView.get(toJrtPath(path), type);
173 }
174
175 @Override
176 public FileStore getFileStore(Path path) throws IOException {
177 return toJrtPath(path).getFileStore();
178 }
179
180 @Override
181 public boolean isHidden(Path path) {
182 return toJrtPath(path).isHidden();
183 }
184
185 @Override
186 public boolean isSameFile(Path path, Path other) throws IOException {
187 return toJrtPath(path).isSameFile(other);
188 }
189
190 @Override
191 public void move(Path src, Path target, CopyOption... options)
192 throws IOException
233 public InputStream newInputStream(Path path, OpenOption... options)
234 throws IOException
235 {
236 return toJrtPath(path).newInputStream(options);
237 }
238
239 @Override
240 public OutputStream newOutputStream(Path path, OpenOption... options)
241 throws IOException
242 {
243 return toJrtPath(path).newOutputStream(options);
244 }
245
246 @Override
247 @SuppressWarnings("unchecked") // Cast to A
248 public <A extends BasicFileAttributes> A
249 readAttributes(Path path, Class<A> type, LinkOption... options)
250 throws IOException
251 {
252 if (type == BasicFileAttributes.class || type == JrtFileAttributes.class)
253 return (A)toJrtPath(path).getAttributes();
254 return null;
255 }
256
257 @Override
258 public Map<String, Object>
259 readAttributes(Path path, String attribute, LinkOption... options)
260 throws IOException
261 {
262 return toJrtPath(path).readAttributes(attribute, options);
263 }
264
265 @Override
266 public void setAttribute(Path path, String attribute,
267 Object value, LinkOption... options)
268 throws IOException
269 {
270 toJrtPath(path).setAttribute(attribute, value, options);
271 }
272 }
|
129 checkPermission();
130 checkUri(uri);
131 return getTheFileSystem();
132 }
133
134 // Checks that the given file is a JrtPath
135 static final JrtPath toJrtPath(Path path) {
136 if (path == null)
137 throw new NullPointerException();
138 if (!(path instanceof JrtPath))
139 throw new ProviderMismatchException();
140 return (JrtPath)path;
141 }
142
143 @Override
144 public void checkAccess(Path path, AccessMode... modes) throws IOException {
145 toJrtPath(path).checkAccess(modes);
146 }
147
148 @Override
149 public Path readSymbolicLink(Path link) throws IOException {
150 return toJrtPath(link).readSymbolicLink();
151 }
152
153 @Override
154 public void copy(Path src, Path target, CopyOption... options)
155 throws IOException
156 {
157 toJrtPath(src).copy(toJrtPath(target), options);
158 }
159
160 @Override
161 public void createDirectory(Path path, FileAttribute<?>... attrs)
162 throws IOException
163 {
164 toJrtPath(path).createDirectory(attrs);
165 }
166
167 @Override
168 public final void delete(Path path) throws IOException {
169 toJrtPath(path).delete();
170 }
171
172 @Override
173 @SuppressWarnings("unchecked")
174 public <V extends FileAttributeView> V
175 getFileAttributeView(Path path, Class<V> type, LinkOption... options)
176 {
177 return JrtFileAttributeView.get(toJrtPath(path), type, options);
178 }
179
180 @Override
181 public FileStore getFileStore(Path path) throws IOException {
182 return toJrtPath(path).getFileStore();
183 }
184
185 @Override
186 public boolean isHidden(Path path) {
187 return toJrtPath(path).isHidden();
188 }
189
190 @Override
191 public boolean isSameFile(Path path, Path other) throws IOException {
192 return toJrtPath(path).isSameFile(other);
193 }
194
195 @Override
196 public void move(Path src, Path target, CopyOption... options)
197 throws IOException
238 public InputStream newInputStream(Path path, OpenOption... options)
239 throws IOException
240 {
241 return toJrtPath(path).newInputStream(options);
242 }
243
244 @Override
245 public OutputStream newOutputStream(Path path, OpenOption... options)
246 throws IOException
247 {
248 return toJrtPath(path).newOutputStream(options);
249 }
250
251 @Override
252 @SuppressWarnings("unchecked") // Cast to A
253 public <A extends BasicFileAttributes> A
254 readAttributes(Path path, Class<A> type, LinkOption... options)
255 throws IOException
256 {
257 if (type == BasicFileAttributes.class || type == JrtFileAttributes.class)
258 return (A)toJrtPath(path).getAttributes(options);
259 return null;
260 }
261
262 @Override
263 public Map<String, Object>
264 readAttributes(Path path, String attribute, LinkOption... options)
265 throws IOException
266 {
267 return toJrtPath(path).readAttributes(attribute, options);
268 }
269
270 @Override
271 public void setAttribute(Path path, String attribute,
272 Object value, LinkOption... options)
273 throws IOException
274 {
275 toJrtPath(path).setAttribute(attribute, value, options);
276 }
277 }
|