1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.zip;
18
19 import java.util.Arrays;
20 import java.util.Collection;
21 import java.util.Collections;
22
23 import org.apache.commons.vfs2.Capability;
24 import org.apache.commons.vfs2.FileName;
25 import org.apache.commons.vfs2.FileObject;
26 import org.apache.commons.vfs2.FileSystem;
27 import org.apache.commons.vfs2.FileSystemConfigBuilder;
28 import org.apache.commons.vfs2.FileSystemException;
29 import org.apache.commons.vfs2.FileSystemOptions;
30 import org.apache.commons.vfs2.FileType;
31 import org.apache.commons.vfs2.provider.AbstractFileName;
32 import org.apache.commons.vfs2.provider.AbstractLayeredFileProvider;
33 import org.apache.commons.vfs2.provider.LayeredFileName;
34
35
36
37
38 public class ZipFileProvider extends AbstractLayeredFileProvider {
39
40
41 protected static final Collection<Capability> capabilities = Collections.unmodifiableCollection(Arrays.asList(Capability.GET_LAST_MODIFIED, Capability.GET_TYPE, Capability.LIST_CHILDREN, Capability.READ_CONTENT,
42 Capability.URI, Capability.COMPRESS, Capability.VIRTUAL));
43
44 public ZipFileProvider() {
45 }
46
47
48
49
50
51
52
53
54
55 @Override
56 protected FileSystem doCreateFileSystem(final String scheme, final FileObject file,
57 final FileSystemOptions fileSystemOptions) throws FileSystemException {
58 final AbstractFileName rootName = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH,
59 FileType.FOLDER);
60 return new ZipFileSystem(rootName, file, fileSystemOptions);
61 }
62
63 @Override
64 public Collection<Capability> getCapabilities() {
65 return capabilities;
66 }
67
68
69
70
71
72
73
74 @Override
75 public FileSystemConfigBuilder getConfigBuilder() {
76 return ZipFileSystemConfigBuilder.getInstance();
77 }
78 }