|
1 /* |
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package jdk.internal.jrtfs; |
|
27 |
|
28 import java.io.IOException; |
|
29 import java.nio.file.Files; |
|
30 import java.nio.file.FileStore; |
|
31 import java.nio.file.FileSystems; |
|
32 import java.nio.file.Path; |
|
33 import java.nio.file.attribute.FileAttributeView; |
|
34 import java.nio.file.attribute.FileStoreAttributeView; |
|
35 import java.nio.file.attribute.BasicFileAttributeView; |
|
36 |
|
37 final class JrtFileStore extends FileStore { |
|
38 |
|
39 private final JrtFileSystem jrtfs; |
|
40 |
|
41 JrtFileStore(JrtPath jrtPath) { |
|
42 this.jrtfs = jrtPath.getFileSystem(); |
|
43 } |
|
44 |
|
45 @Override |
|
46 public String name() { |
|
47 return jrtfs.toString() + "/"; |
|
48 } |
|
49 |
|
50 @Override |
|
51 public String type() { |
|
52 return "jrtfs"; |
|
53 } |
|
54 |
|
55 @Override |
|
56 public boolean isReadOnly() { |
|
57 return jrtfs.isReadOnly(); |
|
58 } |
|
59 |
|
60 @Override |
|
61 public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) { |
|
62 return (type == BasicFileAttributeView.class || |
|
63 type == JrtFileAttributeView.class); |
|
64 } |
|
65 |
|
66 @Override |
|
67 public boolean supportsFileAttributeView(String name) { |
|
68 return name.equals("basic") || name.equals("jrt"); |
|
69 } |
|
70 |
|
71 @Override |
|
72 @SuppressWarnings("unchecked") |
|
73 public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) { |
|
74 if (type == null) |
|
75 throw new NullPointerException(); |
|
76 return (V)null; |
|
77 } |
|
78 |
|
79 @Override |
|
80 public long getTotalSpace() throws IOException { |
|
81 throw new UnsupportedOperationException("getTotalSpace"); |
|
82 } |
|
83 |
|
84 @Override |
|
85 public long getUsableSpace() throws IOException { |
|
86 throw new UnsupportedOperationException("getUsableSpace"); |
|
87 } |
|
88 |
|
89 @Override |
|
90 public long getUnallocatedSpace() throws IOException { |
|
91 throw new UnsupportedOperationException("getUnallocatedSpace"); |
|
92 } |
|
93 |
|
94 @Override |
|
95 public Object getAttribute(String attribute) throws IOException { |
|
96 throw new UnsupportedOperationException("does not support " + attribute); |
|
97 } |
|
98 } |